MCPcopy Index your code
hub / github.com/akshaynagpal/w2n

github.com/akshaynagpal/w2n @1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1 ↗ · + Follow
467 symbols 1,075 edges 21 files 56 documented · 12%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Word to Number Build Status codecov rtdbadge

This is a Python module to convert number words (eg. twenty one) to numeric digits (21). It works for positive numbers upto the range of 999,999,999,999 (i.e. billions) Below is the installation, usage and other details of this module.

Installation

Please ensure that you have updated pip to the latest version before installing word2number.

You can install the module using Python Package Index using the below command.

pip install word2number

Make sure you install all requirements given in requirements.txt

pip install -r requirements.txt

Usage

First you have to import the module using the below code.

from word2number import w2n

Then you can use the word_to_num method to convert a number-word to numeric digits, as shown below.

print(w2n.word_to_num("two million three thousand nine hundred and eighty four"))
2003984
print(w2n.word_to_num('two point three')) 
2.3
print(w2n.word_to_num('112')) 
112
print(w2n.word_to_num('point one')) 
0.1
print(w2n.word_to_num('one hundred thirty-five')) 
135
print(w2n.word_to_num('million million'))
Error: Redundant number! Please enter a valid number word (eg. two million twenty three thousand and forty nine)
None
print(w2n.word_to_num('blah'))
Error: No valid number words found! Please enter a valid number word (eg. two million twenty three thousand and forty nine)
None

Bugs/Errors

Please ensure that you have updated pip to the latest version before installing word2number.

If you find any bugs/errors in the usage of above code, please raise an issue through Github. If you don't know how to use Github or raise an issue through it, I suggest that you should learn it. Else, send an email to akshay2626@gmail.com with a clear example that can reproduce the issue.

Contributors

License

The MIT License (MIT)

Copyright (c) 2016 Akshay Nagpal (https://github.com/akshaynagpal)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Core symbols most depended-on inside this repo

jQuery
called by 39
docs/_build/html/_static/jquery-3.1.0.js
jQuery
called by 39
docs/_build_html/_static/jquery-3.1.0.js
r
called by 37
docs/_build/html/_static/jquery.js
r
called by 37
docs/_build_html/_static/jquery.js
j
called by 17
docs/_build/html/_static/jquery.js
j
called by 17
docs/_build_html/_static/jquery.js
b
called by 16
docs/_build/html/_static/jquery.js
la
called by 16
docs/_build/html/_static/jquery.js

Shape

Function 464
Method 2
Class 1

Languages

TypeScript99%
Python1%

Modules by API surface

docs/_build_html/_static/jquery-3.1.0.js99 symbols
docs/_build/html/_static/jquery-3.1.0.js99 symbols
docs/_build_html/_static/jquery.js84 symbols
docs/_build/html/_static/jquery.js84 symbols
docs/_build_html/_static/websupport.js27 symbols
docs/_build/html/_static/websupport.js27 symbols
docs/_build_html/_static/underscore-1.3.1.js8 symbols
docs/_build/html/_static/underscore-1.3.1.js8 symbols
docs/_build_html/_static/underscore.js7 symbols
docs/_build/html/_static/underscore.js7 symbols
docs/_build_html/_static/searchtools.js4 symbols
docs/_build/html/_static/searchtools.js4 symbols

For agents

$ claude mcp add w2n \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact