Update PxCorpus.py
Browse files- PxCorpus.py +8 -0
PxCorpus.py
CHANGED
|
@@ -50,6 +50,11 @@ class StringIndex:
|
|
| 50 |
|
| 51 |
# Index terms by their first letter and length
|
| 52 |
key = (t[0], len(t))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
if key not in self.vocab_struct:
|
| 55 |
self.vocab_struct[key] = []
|
|
@@ -59,11 +64,14 @@ class StringIndex:
|
|
| 59 |
print("Finished building the index!")
|
| 60 |
|
| 61 |
def find(self, t):
|
|
|
|
| 62 |
key = (t[0], len(t))
|
|
|
|
| 63 |
if t == "milligrammes":
|
| 64 |
print("-"*50)
|
| 65 |
print(key)
|
| 66 |
print(key not in self.vocab_struct)
|
|
|
|
| 67 |
if key not in self.vocab_struct:
|
| 68 |
return False
|
| 69 |
return t in self.vocab_struct[key]
|
|
|
|
| 50 |
|
| 51 |
# Index terms by their first letter and length
|
| 52 |
key = (t[0], len(t))
|
| 53 |
+
|
| 54 |
+
if t == "milligrammes":
|
| 55 |
+
print("/"*50)
|
| 56 |
+
print(key)
|
| 57 |
+
exit(0)
|
| 58 |
|
| 59 |
if key not in self.vocab_struct:
|
| 60 |
self.vocab_struct[key] = []
|
|
|
|
| 64 |
print("Finished building the index!")
|
| 65 |
|
| 66 |
def find(self, t):
|
| 67 |
+
|
| 68 |
key = (t[0], len(t))
|
| 69 |
+
|
| 70 |
if t == "milligrammes":
|
| 71 |
print("-"*50)
|
| 72 |
print(key)
|
| 73 |
print(key not in self.vocab_struct)
|
| 74 |
+
|
| 75 |
if key not in self.vocab_struct:
|
| 76 |
return False
|
| 77 |
return t in self.vocab_struct[key]
|