aboutsummaryrefslogtreecommitdiffstats
path: root/sentence_embedding.py
diff options
context:
space:
mode:
authorYigit Sever2019-09-26 19:52:47 +0300
committerYigit Sever2019-09-26 19:52:47 +0300
commitbf2149485c55f5af7d6db4984ed405d00acfa822 (patch)
tree10ff377b6c67f8cb5997e085c71d0eced60447f3 /sentence_embedding.py
parentd7391ffce2438057113d5c8742d996b0202f5dd2 (diff)
downloadEvaluating-Dictionary-Alignment-bf2149485c55f5af7d6db4984ed405d00acfa822.tar.gz
Evaluating-Dictionary-Alignment-bf2149485c55f5af7d6db4984ed405d00acfa822.tar.bz2
Evaluating-Dictionary-Alignment-bf2149485c55f5af7d6db4984ed405d00acfa822.zip
Include sentence embedding usage
Diffstat (limited to 'sentence_embedding.py')
-rw-r--r--sentence_embedding.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/sentence_embedding.py b/sentence_embedding.py
index 2ac6720..842fae7 100644
--- a/sentence_embedding.py
+++ b/sentence_embedding.py
@@ -103,10 +103,13 @@ def main(args):
103 103
104 result = zip(row_ind, col_ind) 104 result = zip(row_ind, col_ind)
105 hit_at_one = len([x for x, y in result if x == y]) 105 hit_at_one = len([x for x, y in result if x == y])
106 p_at_one = hit_at_one / instances
106 percentage = hit_at_one / instances * 100 107 percentage = hit_at_one / instances * 100
107 108
108 if not batch: 109 if not batch:
109 print(f"{hit_at_one} definitions have been matched correctly") 110 print(f"{paradigm} - semb on {source_lang} - {target_lang}")
111 print(f"P @ 1: {p_at_one}")
112 print(f"{percentage} {instances} definitions")
110 113
111 if batch: 114 if batch:
112 fields = [ 115 fields = [
@@ -159,7 +162,7 @@ if __name__ == "__main__":
159 parser.add_argument( 162 parser.add_argument(
160 "-n", 163 "-n",
161 "--instances", 164 "--instances",
162 help="number of instances in each language to retrieve", 165 help="number of instances in each language to use",
163 default=1000, 166 default=1000,
164 type=int, 167 type=int,
165 ) 168 )
@@ -167,7 +170,7 @@ if __name__ == "__main__":
167 "-b", 170 "-b",
168 "--batch", 171 "--batch",
169 action="store_true", 172 action="store_true",
170 help="running in batch (store results in csv) or" 173 help="running in batch (store results in csv) or "
171 + "running a single instance (output the results)", 174 + "running a single instance (output the results)",
172 ) 175 )
173 parser.add_argument( 176 parser.add_argument(