GithubHelp home page GithubHelp logo

Comments (3)

saffsd avatar saffsd commented on August 29, 2024

Hi remibolcom, thanks for reporting the issue and sorry it has taken me so long to address it. I (strangely) don't seem to be able able to reproduce the issue on either the python3 branch or the master branch. Nonetheless, I take your point and I've updated the master branch accordingly. I hope to delete the python3 branch at some point - the main langid.py classifier in master should be compatible with both python2 and python3.

from langid.py.

kellymarchisio avatar kellymarchisio commented on August 29, 2024

FYI, I just got this error using the conda install.

conda create -n wmt18-filtering python=3.6 numpy
source activate wmt18-filtering
conda install -c activisiongamescience langid
langid

Results in:

Traceback (most recent call last): File "/home/kmarc/anaconda3/envs/wmt18-filtering/bin/langid", line 6, in <module> sys.exit(langid.langid.main()) File "/home/kmarc/anaconda3/envs/wmt18-filtering/lib/python3.5/site-packages/langid/langid.py", line 498, in main identifier = LanguageIdentifier.from_modelstring(model, norm_probs = options.normalize) File "/home/kmarc/anaconda3/envs/wmt18-filtering/lib/python3.5/site-packages/langid/langid.py", line 182, in from_modelstring nb_ptc = np.array(nb_ptc).reshape(len(nb_ptc)/len(nb_pc), len(nb_pc)) TypeError: 'float' object cannot be interpreted as an integer

from langid.py.

bm777 avatar bm777 commented on August 29, 2024

FYI, I just got this error using the conda install.

conda create -n wmt18-filtering python=3.6 numpy source activate wmt18-filtering conda install -c activisiongamescience langid langid

Results in:

Traceback (most recent call last): File "/home/kmarc/anaconda3/envs/wmt18-filtering/bin/langid", line 6, in <module> sys.exit(langid.langid.main()) File "/home/kmarc/anaconda3/envs/wmt18-filtering/lib/python3.5/site-packages/langid/langid.py", line 498, in main identifier = LanguageIdentifier.from_modelstring(model, norm_probs = options.normalize) File "/home/kmarc/anaconda3/envs/wmt18-filtering/lib/python3.5/site-packages/langid/langid.py", line 182, in from_modelstring nb_ptc = np.array(nb_ptc).reshape(len(nb_ptc)/len(nb_pc), len(nb_pc)) TypeError: 'float' object cannot be interpreted as an integer


Hi @kellymarchisio ,
You should use the workaround of @remibolcom

This is because in python3, dividing integers produces a float. The fix is to change line 163 from

nb_numfeats = len(nb_ptc) / len(nb_pc)

to

nb_numfeats = int(len(nb_ptc) / len(nb_pc))

and to change line 167 to this:

nb_ptc = np.array(nb_ptc).reshape(nb_numfeats, len(nb_pc))

from langid.py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.