remove load_indices()

This commit is contained in:
relikd
2021-02-13 00:41:19 +01:00
parent 686afb6f26
commit e4b4ed4498
5 changed files with 32 additions and 52 deletions

View File

@@ -2,7 +2,6 @@
# -*- coding: UTF-8 -*-
import re
from Alphabet import RUNES
from IOReader import re_norune
from RuneText import RuneText
from LPath import LPath
@@ -33,7 +32,7 @@ class NGrams(object):
@staticmethod
def make(gramsize, infile, outfile):
with open(infile, 'r') as f:
data = re_norune.sub('', f.read())
data = re.sub('[^' + ''.join(RUNES) + ']', '', f.read())
res = {x: 0 for x in RUNES} if gramsize == 1 else {}
for i in range(len(data) - gramsize + 1):
@@ -74,3 +73,4 @@ if __name__ == '__main__':
# make_translation(stream=False)
# make_ngrams(5)
print(NGrams.load(2))