Update README.md
Browse files
README.md
CHANGED
@@ -28,3 +28,16 @@ Be careful - some items are whole words already.
|
|
28 |
|
29 |
Use as a training set for abbreviations or as part of a GEC task
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
Use as a training set for abbreviations or as part of a GEC task
|
30 |
|
31 |
+
```python
|
32 |
+
import csv
|
33 |
+
# Load abbreviations and their expansions from sms.csv into a dictionary
|
34 |
+
abbreviations_dict = {}
|
35 |
+
with open('sms.csv', mode='r', encoding='utf-8') as infile:
|
36 |
+
# Specify the delimiter as a tab character
|
37 |
+
reader = csv.reader(infile, delimiter='\t')
|
38 |
+
for row in reader:
|
39 |
+
if len(row) >= 2:
|
40 |
+
abbreviations_dict[row[0].strip().upper()] = row[1].strip()
|
41 |
+
else:
|
42 |
+
print(f"Skipping malformed row: {row}")
|
43 |
+
```
|