Update PxCorpus.py
Browse files- PxCorpus.py +3 -3
PxCorpus.py
CHANGED
|
@@ -36,6 +36,8 @@ of 55 participants (38% non-experts, 25% doctors, 36% medical practitioners), ma
|
|
| 36 |
|
| 37 |
_URL = "https://zenodo.org/record/6524162/files/pxslu.zip?download=1"
|
| 38 |
|
|
|
|
|
|
|
| 39 |
class StringIndex:
|
| 40 |
|
| 41 |
def __init__(self, vocab):
|
|
@@ -137,8 +139,6 @@ class PxCorpus(datasets.GeneratorBasedBuilder):
|
|
| 137 |
|
| 138 |
def getTokenTags(self, document):
|
| 139 |
|
| 140 |
-
VOCAB = StringIndex(vocab=open("./vocabulary_nachos_lowercased.txt","r").read().split("\n"))
|
| 141 |
-
|
| 142 |
tokens = []
|
| 143 |
ner_tags = []
|
| 144 |
is_oov = []
|
|
@@ -151,7 +151,7 @@ class PxCorpus(datasets.GeneratorBasedBuilder):
|
|
| 151 |
text, label = pair.split("\t")
|
| 152 |
tokens.append(text)
|
| 153 |
ner_tags.append(label)
|
| 154 |
-
is_oov.append(
|
| 155 |
|
| 156 |
return tokens, ner_tags, is_oov
|
| 157 |
|
|
|
|
| 36 |
|
| 37 |
_URL = "https://zenodo.org/record/6524162/files/pxslu.zip?download=1"
|
| 38 |
|
| 39 |
+
_VOCAB = StringIndex(vocab=open("./vocabulary_nachos_lowercased.txt","r").read().split("\n"))
|
| 40 |
+
|
| 41 |
class StringIndex:
|
| 42 |
|
| 43 |
def __init__(self, vocab):
|
|
|
|
| 139 |
|
| 140 |
def getTokenTags(self, document):
|
| 141 |
|
|
|
|
|
|
|
| 142 |
tokens = []
|
| 143 |
ner_tags = []
|
| 144 |
is_oov = []
|
|
|
|
| 151 |
text, label = pair.split("\t")
|
| 152 |
tokens.append(text)
|
| 153 |
ner_tags.append(label)
|
| 154 |
+
is_oov.append(_VOCAB.find(text))
|
| 155 |
|
| 156 |
return tokens, ner_tags, is_oov
|
| 157 |
|