File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ import sys
4+
5+ from finalfusion import Embeddings
6+
7+ if __name__ == "__main__" :
8+ if len (sys .argv ) != 2 :
9+ sys .stderr .write ("Usage: %s embeddings\n " % sys .argv [0 ])
10+ sys .exit (1 )
11+
12+ embeds = Embeddings (sys .argv [1 ])
13+
14+ for line in sys .stdin :
15+ print (" " .join (map (lambda v : str (v ), embeds .embedding (line .strip ()))))
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ import sys
4+
5+ from finalfusion import Embeddings
6+
7+ if __name__ == "__main__" :
8+ if len (sys .argv ) != 2 :
9+ sys .stderr .write ("Usage: %s embeddings\n " % sys .argv [0 ])
10+ sys .exit (1 )
11+
12+ embeds = Embeddings (sys .argv [1 ])
13+
14+ for line in sys .stdin :
15+ for result in embeds .similarity (line .strip ()):
16+ print ("%s\t %.2f" % (result .word , result .similarity ))
You can’t perform that action at this time.
0 commit comments