Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Commit

Permalink
adapt regex for splitting pdf into single days
Browse files Browse the repository at this point in the history
  • Loading branch information
srehwald committed Feb 12, 2018
1 parent 028e202 commit 0abd45d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/menu_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ def get_menus(self, text, year, week_number):
class IPPBistroMenuParser(MenuParser):
url = "http://konradhof-catering.de/ipp/"
weekday_positions = {"mon": 1, "tue": 2, "wed": 3, "thu": 4, "fri": 5}
split_days_regex = r'(Tagessuppe siehe Aushang|Aschermittwoch)'
price_regex = r"\d+,\d+\s\€[^\)]"
dish_regex = r".+?\d+,\d+\s\€[^\)]"

Expand Down Expand Up @@ -313,7 +314,7 @@ def get_menus(self, text, year, week_number):
weekdays = lines[0]
lines = lines[3:]

positions = [(a.start(), a.end()) for a in list(re.finditer('Tagessuppe siehe Aushang', lines[0]))]
positions = [(a.start(), a.end()) for a in list(re.finditer(self.split_days_regex, lines[0]))]
if len(positions) != 5:
# TODO handle special cases (e.g. that bistro is closed)
return None
Expand Down

0 comments on commit 0abd45d

Please sign in to comment.