Просмотр исходного кода

Update highlighter for new MarkovChain implementation

master
Ben Kurtovic 5 лет назад
Родитель
Сommit
c73179b28c
1 измененных файлов: 2 добавлений и 3 удалений
  1. +2
    -3
      copyvios/highlighter.py

+ 2
- 3
copyvios/highlighter.py Просмотреть файл

@@ -16,14 +16,13 @@ def highlight_delta(context, chain, delta):
delta = EMPTY_INTERSECTION delta = EMPTY_INTERSECTION
for word in chain.text.split() + ([chain.END] * degree): for word in chain.text.split() + ([chain.END] * degree):
word = _strip_word(chain, word) word = _strip_word(chain, word)
tblock = tuple(block)
if tblock in delta.chain and word in delta.chain[tblock]:
block.append(word)
if tuple(block) in delta.chain:
highlights[-1 * degree:] = [True] * degree highlights[-1 * degree:] = [True] * degree
highlights.append(True) highlights.append(True)
else: else:
highlights.append(False) highlights.append(False)
block.popleft() block.popleft()
block.append(word)


i = degree i = degree
numwords = len(chain.text.split()) numwords = len(chain.text.split())


Загрузка…
Отмена
Сохранить