mirror of
https://github.com/wassname/multifit.git
synced 2026-10-28 13:10:15 +08:00
Make the article detection code work with our wikitext
This commit is contained in:
1 parent
0945c699c7
commit
f784d7bcd2
1 file changed
+2
-1
@@ -35,7 +35,7 @@ class Tokenizers(Enum):
|
||||
FASTAI='f'
|
||||
|
||||
def istitle(line):
|
||||
return len(re.findall(r'^ = [^=]* = $', line)) != 0
|
||||
return len(re.findall(r'^ ?= [^=]* = ?$', line)) != 0
|
||||
|
||||
def read_wiki_articles(filename):
|
||||
articles = []
|
||||
@@ -48,6 +48,7 @@ def read_wiki_articles(filename):
|
||||
articles.append(current_article)
|
||||
current_article = ''
|
||||
articles.append(current_article)
|
||||
print(f"Wiki text was split to {len(articles)} articles")
|
||||
return pd.DataFrame({'texts':np.array(articles)})
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in new issue
Block a user