-1

I installed word2number via poetry add poetry. However, I was unable to call any functions from word2number after the installation

import word2number as w2n
w2n.word_to_num('one')

The following error happened

AttributeError: module 'word2number' has no attribute 'word_to_num'

When I call w2n.*? the following functions are returned.

w2n.__builtins__
w2n.__cached__
w2n.__class__
w2n.__delattr__
w2n.__dict__
w2n.__dir__
w2n.__doc__
w2n.__eq__
w2n.__file__
w2n.__format__
w2n.__ge__
w2n.__getattribute__
w2n.__gt__
w2n.__hash__
w2n.__init__
w2n.__init_subclass__
w2n.__le__
w2n.__loader__
w2n.__lt__
w2n.__name__
w2n.__ne__
w2n.__new__
w2n.__package__
w2n.__path__
w2n.__reduce__
w2n.__reduce_ex__
w2n.__repr__
w2n.__setattr__
w2n.__sizeof__
w2n.__spec__
w2n.__str__
w2n.__subclasshook__

Poetry lock file

[[package]]
name = "word2number"
version = "1.1"
description = "Convert number words eg. three hundred and forty two to numbers (342)."
category = "main"
optional = false
python-versions = "*"
Boon
  • 75
  • 4

1 Answers1

1

The package is called word2number but the module itself is w2n (as in the docs). Importing correctly will solve your issue:

from word2number import w2n
print(w2n.word_to_num('one'))
jezza_99
  • 1,074
  • 1
  • 5
  • 17