diff options
author | ygorshenin <mipt.vi002@gmail.com> | 2016-07-14 12:23:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-14 12:23:40 +0300 |
commit | 99345452166d0896e52bd831a86bb56282fe3855 (patch) | |
tree | 8e45cbc40963560373871a8bbd3eb3c4b695c348 /tools | |
parent | bc98ef2a672d55fd7fb2ddbf97c573488d4ca574 (diff) | |
parent | 61babee342ffe9da76e920aba8c61294607ab2f1 (diff) |
Merge pull request #3761 from mgsergio/booking-name-matching
[booking] Booking name matching
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/python/booking_hotels.py | 6 | ||||
-rwxr-xr-x | tools/python/booking_hotels_quality.py | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/tools/python/booking_hotels.py b/tools/python/booking_hotels.py index f684505036..8912fdebe9 100755 --- a/tools/python/booking_hotels.py +++ b/tools/python/booking_hotels.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # coding: utf8 from __future__ import print_function @@ -126,7 +126,8 @@ def translate(source, output): ''' Reads *.pkl files and produces a single list of hotels as tab separated values. ''' - files = [filename for filename in os.listdir(source) if filename.endswith('.pkl')] + files = [os.path.join(source, filename) + for filename in os.listdir(source) if filename.endswith('.pkl')] data = [] for filename in sorted(files): @@ -207,6 +208,7 @@ def process_options(): if not options.download and not options.translate: parser.print_help() + # TODO(mgsergio): implpement it with argparse facilities. if options.translate and not options.output: print("--output isn't set") parser.print_help() diff --git a/tools/python/booking_hotels_quality.py b/tools/python/booking_hotels_quality.py index 9c81dad52a..cd82adfd2d 100755 --- a/tools/python/booking_hotels_quality.py +++ b/tools/python/booking_hotels_quality.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # coding: utf8 from __future__ import print_function @@ -14,6 +14,7 @@ import os import pickle import time import urllib2 +import re # init logging logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s] %(levelname)s: %(message)s') @@ -21,7 +22,7 @@ logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s] %(levelname)s: %( def load_binary_list(path): """ - Loads binary classifier output. + Loads reference binary classifier output. """ bits = [] with open(path, 'r') as fd: @@ -41,11 +42,12 @@ def load_score_list(path): for line in fd: if (not line.strip()) or line[0] == '#': continue - scores.append(float(line[line.rfind(':')+2:])) + scores.append(float(re.search(r'result score: (\d*\.\d+)', line).group(1))) return scores def process_options(): + # TODO(mgsergio): Fix description. parser = argparse.ArgumentParser(description="Download and process booking hotels.") parser.add_argument("-v", "--verbose", action="store_true", dest="verbose") parser.add_argument("-q", "--quiet", action="store_false", dest="verbose") |