MotzWanted
commited on
Commit
·
119b02b
1
Parent(s):
bac6bc4
Update medwiki.py
Browse files- medwiki.py +0 -16
medwiki.py
CHANGED
@@ -99,22 +99,6 @@ class MedWikipediaCorpusGenerator(datasets.GeneratorBasedBuilder):
|
|
99 |
)
|
100 |
]
|
101 |
|
102 |
-
@staticmethod
|
103 |
-
def _clean_text(text)-> str:
|
104 |
-
text = text.lower()
|
105 |
-
# remove "\u" followed by 4 characters
|
106 |
-
text = re.sub(r"\\u[0-9a-fA-F]{4}", "", text)
|
107 |
-
# remove scientific citations (e.g. (Smith, J. et al., 2014) )
|
108 |
-
text = re.sub(r"\((?:[\w \.&]+\, )+[0-9]{4}\)", "", text)
|
109 |
-
# remove figure and table references (e.g. (figure 7\xe2\x80\x9377) )
|
110 |
-
text = re.sub(r"\s*\(\s*(?:table|figure)[^()]*\)", "", text)
|
111 |
-
# remove hex characters (e.g. \xe2\x80\x94\xe2\x80\x89)
|
112 |
-
text = re.sub(r"[^\x00-\x7f]+", " ", text)
|
113 |
-
text = re.sub(r"[\n\r\t]+", " ", text)
|
114 |
-
text = re.sub(r"([^a-zA-Z0-9\.])", " ", text)
|
115 |
-
|
116 |
-
return text
|
117 |
-
|
118 |
def _generate_examples(self, output_dir: str):
|
119 |
logger.info("generating examples from = %s", output_dir)
|
120 |
paths = [
|
|
|
99 |
)
|
100 |
]
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
def _generate_examples(self, output_dir: str):
|
103 |
logger.info("generating examples from = %s", output_dir)
|
104 |
paths = [
|