Commit 388b0e69 authored by Administrator's avatar Administrator

[FIX] If ngrams list is empty.

parent d779511a
...@@ -345,7 +345,11 @@ def test_ngrams(request , project_id, corpus_id ): ...@@ -345,7 +345,11 @@ def test_ngrams(request , project_id, corpus_id ):
ngrams_ids = Ngrams_Scores.keys() ngrams_ids = Ngrams_Scores.keys()
import math import math
occs_threshold = min ( 10 , math.sqrt(Sum / len(ngrams_ids)) )
if len(ngrams_ids) != 0:
occs_threshold = min ( 10 , math.sqrt(Sum / len(ngrams_ids)) )
else:
occs_threshold = 10
Metrics = { Metrics = {
"ngrams":[], "ngrams":[],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment