Browse Source

Merge branch 'local'

Xi Ruoyao 4 years ago
parent
commit
d72ccd0382
2 changed files with 11 additions and 10 deletions
  1. 2 2
      data.py
  2. 9 8
      recog.py

+ 2 - 2
data.py

@@ -6,7 +6,7 @@ def have_location(x):
     return x.lat != None and x.lon != None
 
 def maybe_entry(x):
-    return x.eig < 5 and x.prec > 40
+    return x.eig < 5 and (x.prec > 40 or x.prec < 0)
 
 def maybe_indoor(x):
-    return x.eig < 1 and x.prec > 400
+    return x.eig < 1 and (x.prec > 400 or x.prec < 0)

+ 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