-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,27 @@ | ||
# Number to Words Contextual Library | ||
# MathSpell | ||
|
||
This library converts numbers to words based on their context. For example: | ||
- For years: "2015" -> "twenty fifteen" | ||
- For quantities: "2015" -> "two thousand and fifteen" | ||
MathSpell is a Python package for converting numbers into contextually appropriate words, such as "twenty-first century" for years or "two thousand and twenty-three" for general numbers. | ||
|
||
## Installation | ||
|
||
1. Install the package: | ||
```bash | ||
pip install mathspell | ||
``` | ||
|
||
2. Download the required spaCy language model: | ||
```bash | ||
python -m spacy download en_core_web_sm | ||
``` | ||
|
||
## Usage | ||
|
||
After installation, you can use MathSpell to process text containing numbers. For example: | ||
|
||
```python | ||
from mathspell import analyze_text | ||
text = "This is the 21st century. I was born in 1995." | ||
converted_text = analyze_text(text) | ||
print(converted_text) | ||
# Output: "This is the twenty-first century. I was born in nineteen ninety-five." |