Skip to content

Commit

Permalink
json converter stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEnquirer committed Apr 7, 2021
1 parent c6fafb2 commit 9db8cdf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions json_converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# json converter tests, for react stuff

import json

a = [('queen', 0.8407386541366577), ('monarch', 0.7541723847389221), ('prince', 0.7350203394889832), ('princess', 0.696908175945282), ('empress', 0.6771803498268127), ('sultan', 0.6649758815765381), ('Chakri', 0.6451102495193481), ('goddess', 0.6439394950866699), ('ruler', 0.6275452971458435), ('kings', 0.6273427605628967)]


b = json.dumps(a)


print(b)


# out: [["queen", 0.8407386541366577], ["monarch", 0.7541723847389221], ["prince", 0.7350203394889832], ["princess", 0.696908175945282], ["empress", 0.6771803498268127], ["sultan", 0.6649758815765381], ["Chakri", 0.6451102495193481], ["goddess", 0.6439394950866699], ["ruler", 0.6275452971458435], ["kings", 0.6273427605628967]]






2 changes: 1 addition & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Cosmul seems to work better

# a = wordvec.most_similar(positive=['king', 'woman'], negative=['man'], topn=3)
# a = wordvec.most_similar(positive=['king', 'woman'], negative=['man'], topn=10)
# print(a)


Expand Down

0 comments on commit 9db8cdf

Please sign in to comment.