unsupervised-semantic-diff / get_max_min_values.py
jvamvas's picture
Basic implementation
fda57dd
raw
history blame contribute delete
612 Bytes
"""
Get similarities of similar and dissimilar pairs.
The values are used for normalizing the colors in the visualization.
"""
from app import load_pipeline
from recognizers import DiffAlign, DiffDel
similar_pair = ("Hello!", "Hi!")
dissimilar_pair = ("Hello!", "asdf")
pipeline = load_pipeline()
diff_align = DiffAlign(pipeline=pipeline)
diff_del = DiffDel(pipeline=pipeline)
print("Similar pair:")
print(diff_align.predict(*similar_pair).min)
print(diff_del.predict(*similar_pair).min)
print("Dissimilar pair:")
print(diff_align.predict(*dissimilar_pair).max)
print(diff_del.predict(*dissimilar_pair).max)