Browse Source

relax the condition of data before door

Xi Ruoyao 4 years ago
parent
commit
12eeec6c1e
1 changed files with 9 additions and 8 deletions
  1. 9 8
      recog.py

+ 9 - 8
recog.py

@@ -1,10 +1,11 @@
 import data
 
-def list_have_location(l):
+def count_have_location(l):
+    ans = 0
     for d in l:
-        if not data.have_location(d):
-            return False
-    return True
+        if data.have_location(d):
+            ans += 1
+    return ans
 
 def list_have_continue_maybe_indoor(l):
     last_indoor = False
@@ -16,10 +17,10 @@ def list_have_continue_maybe_indoor(l):
     return False
 
 def check_entry(before, curr, after):
-    if not list_have_location(before):
-        return None
     if not data.have_location(curr):
         return None
+    if count_have_location(before) < 9:
+        return None
     if not data.maybe_entry(curr):
         return None
     if data.maybe_entry(before[-1]):
@@ -30,8 +31,8 @@ def check_entry(before, curr, after):
 
 def recognize_entries(l):
     ret = []
-    for i in range(60, len(l) - 12):
-        x = check_entry(l[i-60:i], l[i], l[i+1:i+13])
+    for i in range(59, len(l) - 12):
+        x = check_entry(l[i-59:i], l[i], l[i+1:i+13])
         if not x is None:
             ret.append(x)
     return ret