Hanna Abi Akl commited on
Commit
8daadc1
1 Parent(s): b0fd1ba

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -18
README.md CHANGED
@@ -1,4 +1,5 @@
1
  ---
 
2
  pipeline_tag: sentence-similarity
3
  tags:
4
  - sentence-transformers
@@ -91,22 +92,22 @@ import torch
91
  model = SentenceTransformer('yseop/roberta-base-finance-hypernym-identification')
92
  # Our corpus containing the list of hypernym labels
93
  hypernyms = ['Bonds',
94
- 'Forward',
95
- 'Funds',
96
- 'Future',
97
- 'MMIs',
98
- 'Option',
99
- 'Stocks',
100
- 'Swap',
101
- 'Equity Index',
102
- 'Credit Index',
103
- 'Securities restrictions',
104
- 'Parametric schedules',
105
- 'Debt pricing and yields',
106
- 'Credit Events',
107
- 'Stock Corporation',
108
- 'Central Securities Depository',
109
- 'Regulatory Agency']
110
  hypernym_embeddings = model.encode(hypernyms, convert_to_tensor=True)
111
  # Query sentences are financial terms to match to the predefined labels
112
  queries = ['Convertible bond', 'weighted average coupon', 'Restriction 144-A']
@@ -117,9 +118,14 @@ for query in queries:
117
  # We use cosine-similarity and torch.topk to find the highest 5 scores
118
  cos_scores = util.pytorch_cos_sim(query_embedding, hypernym_embeddings)[0]
119
  top_results = torch.topk(cos_scores, k=top_k)
120
- print("\n\n======================\n\n")
 
 
 
 
121
  print("Query:", query)
122
- print("\nTop 5 most similar hypernyms:")
 
123
  for score, idx in zip(top_results[0], top_results[1]):
124
  print(hypernyms[idx], "(Score: {:.4f})".format(score))
125
  ```
 
1
  ---
2
+ inference: false
3
  pipeline_tag: sentence-similarity
4
  tags:
5
  - sentence-transformers
 
92
  model = SentenceTransformer('yseop/roberta-base-finance-hypernym-identification')
93
  # Our corpus containing the list of hypernym labels
94
  hypernyms = ['Bonds',
95
+ \t\t\t'Forward',
96
+ \t\t\t'Funds',
97
+ \t\t\t'Future',
98
+ \t\t\t'MMIs',
99
+ \t\t\t'Option',
100
+ \t\t\t'Stocks',
101
+ \t\t\t'Swap',
102
+ \t\t\t'Equity Index',
103
+ \t\t\t'Credit Index',
104
+ \t\t\t'Securities restrictions',
105
+ \t\t\t'Parametric schedules',
106
+ \t\t\t'Debt pricing and yields',
107
+ \t\t\t'Credit Events',
108
+ \t\t\t'Stock Corporation',
109
+ \t\t\t'Central Securities Depository',
110
+ \t\t\t'Regulatory Agency']
111
  hypernym_embeddings = model.encode(hypernyms, convert_to_tensor=True)
112
  # Query sentences are financial terms to match to the predefined labels
113
  queries = ['Convertible bond', 'weighted average coupon', 'Restriction 144-A']
 
118
  # We use cosine-similarity and torch.topk to find the highest 5 scores
119
  cos_scores = util.pytorch_cos_sim(query_embedding, hypernym_embeddings)[0]
120
  top_results = torch.topk(cos_scores, k=top_k)
121
+ print("\
122
+ \
123
+ ======================\
124
+ \
125
+ ")
126
  print("Query:", query)
127
+ print("\
128
+ Top 5 most similar hypernyms:")
129
  for score, idx in zip(top_results[0], top_results[1]):
130
  print(hypernyms[idx], "(Score: {:.4f})".format(score))
131
  ```