Skip to content

Commit

Permalink
fix: #17
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Sep 4, 2018
1 parent 47ee1f7 commit 02d9de3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cophi/api.py
Expand Up @@ -5,12 +5,19 @@
This module implements the high-level API.
"""

import logging
import pathlib
import uuid
import pandas as pd
import cophi.model


logging.basicConfig(level=logging.INFO,
format="(%(asctime)s) %(levelname)s: %(message)s",
datefmt="%H:%M:%S")
logger = logging.getLogger("cophi.api")


def document(filepath, **kwargs):
"""Read a text file and create a Document object.
Expand Down Expand Up @@ -58,6 +65,7 @@ def lazy_reading(filepaths):
metadata = cophi.model.Metadata()
documents = pd.Series()
for textfile in lazy_reading(filepaths):
logger.info("Processing '{}' ...".format(textfile.title))
document_uuid = str(uuid.uuid1())
text = textfile.content
document = cophi.model.Document(text,
Expand All @@ -73,4 +81,5 @@ def lazy_reading(filepaths):
"title": textfile.title,
"suffix": textfile.filepath.suffix},
ignore_index=True)
logger.info("Constructing Corpus object ...")
return cophi.model.Corpus(documents), metadata

0 comments on commit 02d9de3

Please sign in to comment.