Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liao961120 committed Apr 18, 2020
1 parent 89f7da8 commit 99d161c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache --virtual .build-deps gcc libc-dev libxslt-dev && \
pip install --no-cache-dir lxml>=3.5.0 && \
apk del .build-deps

COPY requirements.txt /usr/src/app
COPY requirements-docker.txt /usr/src/app
RUN pip install -r requirements-docker.txt
COPY . /usr/src/app
EXPOSE 80
Expand Down
5 changes: 3 additions & 2 deletions GlossProcessor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import re
import logging
from docx import Document


Expand Down Expand Up @@ -56,7 +57,7 @@ def _load_data(self, path):
try:
glosses = process_doc(os.path.join(path, filename))
except:
print(f"Invalid formatting in docx: `{filename}`")
logging.warning(f"Invalid formatting in docx: `{filename}`")
continue
self.data[filename] = tokenize_glosses(glosses, filename)

Expand Down Expand Up @@ -209,7 +210,7 @@ def tokenize_glosses(glosses, filname):
num_of_lines = len(gloss_lines)

if num_of_lines % 3 != 0:
print(f"Invalid gloss formatting: #{glosses[gloss_id][0]} in {filname}")
logging.warning(f"Invalid gloss formatting: #{glosses[gloss_id][0]} in {filname}")
continue

# Concat multiple lines to three
Expand Down
3 changes: 0 additions & 3 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from GlossProcessor import GlossProcessor
from GlossProcessor import get_files_timestamp


logging.basicConfig(format='\n[GLOSS-SEARCH]: %(message)s\n', datefmt='%Y/%m/%d %I:%M:%S', level=logging.INFO)

# Initialize corpus
Expand Down Expand Up @@ -79,8 +78,6 @@ def on_get(self, req, resp):
if __name__ == '__main__':
from wsgiref import simple_server

logging.basicConfig(format='\n[GLOSS-SEARCH]: %(message)s\n', datefmt='%Y/%m/%d %I:%M:%S', level=logging.INFO)

port = 1420
print(f"Start serving at http://localhost:{port}")
httpd = simple_server.make_server('localhost', port, app)
Expand Down

0 comments on commit 99d161c

Please sign in to comment.