Skip to content
This repository was archived by the owner on Jul 9, 2026. It is now read-only.

gitcommunity/textsorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pip install textsorter

How to use it?

>>> from textsorter import textsorter
>>> your_text = "Hello, Hello how are you?"
>>> sorted_text = textsorter.sort_text(your_text)
>>> print(sorted_text)
{'Hello': 2, 'how': 1, 'are': 1, 'you': 1}

BeautifulTable

>>> from beautifultable import BeautifulTable
>>> table = BeautifulTable()
>>> text_sorter_data = {'Hello': 2, 'how': 1, 'are': 1, 'you': 1}
>>> for i in text_sorter_data.items():
...	table.rows.append([i[0], i[1]])
...
>>> table.columns.header = ["Word", "Count"]
>>> print(table)
+-------+-------+
| Word  | Count |
+-------+-------+
| Hello |   2   |
+-------+-------+
|  how  |   1   |
+-------+-------+
|  are  |   1   |
+-------+-------+
|  you  |   1   |
+-------+-------+

About

The script ranks words by frequency in descending order.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages