in captum/insights/attr_vis/frontend/src/components/Feature.tsx [63:92]
function TextFeature(props: TextFeatureProps) {
const color_words = props.data.base.map((w, i) => {
return (
<>
<span
style={{
backgroundColor: calcHSLFromScore(props.data.modified[i], false),
}}
className={styles["text-feature-word"]}
>
{w}
<Tooltip label={props.data.modified[i]?.toFixed(3)} />
</span>{" "}
</>
);
});
return (
<>
{props.hideHeaders && (
<div className={styles["panel__column__title"]}>
{props.data.name} (Text)
</div>
)}
<div className={styles["panel__column__body"]}>
<div className={styles["model-number-spacer"]} />
{color_words}
</div>
</>
);
}