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

doc.to_bag_of_terms return empty items in docker #208

Open
jeronimo13 opened this issue Aug 14, 2018 · 0 comments
Open

doc.to_bag_of_terms return empty items in docker #208

jeronimo13 opened this issue Aug 14, 2018 · 0 comments

Comments

@jeronimo13
Copy link

jeronimo13 commented Aug 14, 2018

Hi, I have function

def bag_of_term(text):
  doc = textacy.Doc(text)
  bot = doc.to_bag_of_terms(ngrams=(2, 3, 4), named_entities=True, weighting='count', as_strings=True)
  print(bot.items())
  return sorted(bot.items(), key=lambda x: x[1], reverse=True)

which works normally and returns ngrams on my machine

  • operating system:Mac OS high sierra 10.13.6
  • python version: 3.6
  • spacy version: 2.0
  • installed spacy models: en_core_web_lg
  • textacy version: latest

I use this function behind flask REST API

But when I run it inside Docker image and use it via REST endpoint I've got
dict_items([('', 520)]) which I consider empty.

This is my docker looks like

FROM floydhub/textacy

## Install dependencies
RUN pip --no-cache-dir install \
        flask

COPY . /app
WORKDIR /app
ENTRYPOINT ["python"]
EXPOSE 8000
CMD ["app.py"]

I've tried several Dockerfile setups(including writing my own) and end up with written above, but all of them have this issue with empty doc.to_bag_of_terms

Any ideas how to run textacy inside docker?

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

No branches or pull requests

1 participant