Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better cleaning #8

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Better cleaning #8

wants to merge 29 commits into from

Conversation

cquest
Copy link
Member

@cquest cquest commented Feb 14, 2018

More variations for BP/CS/CIDEX/TSA like:
B.P 41
TSA N°41

Cleans phone/fax numbers too...

@@ -50,14 +50,17 @@


def clean_query(q):
q = re.sub(r'([\d]{5})', r' \1 ', q, flags=re.IGNORECASE)
q = re.sub(r'(^| )(boite postale|b\.?p\.?|cs|tsa|cidex) *(n(o|°|) *|)[\d]+ *', r'\1', q, flags=re.IGNORECASE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regex is quite slow, I'm not sure we wanna go that far in cleaning.
Have you had a look on perfs? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regexp are not that slow (I measured 3µs for this one)... and it is called just once to clean the query

@@ -116,14 +119,17 @@ def flag_housenumber(tokens):

def fold_ordinal(s):
"""3bis => 3b."""
if s[0].isdigit() and not s.isdigit():
if s is not None and s !='' and s[0].isdigit() and not s.isdigit():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this needs to be fixed properly beforehand. I'll have a look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No way to reproduce the issue, neither from the shell, the pyshell or the http API.

Can you be a bit more specific on how you get the issue here? A simple way to reproduce from shell or pyshell would help :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs either a reproducable test case (so we can understand) either removal :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants