natlangproc 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2026 Diouf Tech
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ Quote Diouf Tech in any of your work using this package, or PayPal us :
14
+ https://www.paypal.com/paypalme/mathgamepy
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,27 @@
1
+ Metadata-Version: 2.4
2
+ Name: natlangproc
3
+ Version: 1.0.0
4
+ Summary: Package for NLP (Natural Language Processing) in Python
5
+ Home-page: https://www.paypal.com/paypalme/mathgamepy
6
+ Author: Aliou Diouf
7
+ Author-email: aliou.diouf5@gmail.com
8
+ License: Diouf Tech
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: License :: Free To Use But Restricted
11
+ Classifier: Programming Language :: Python :: 3.14
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENCE.txt
14
+ Requires-Dist: flake8
15
+ Requires-Dist: pytest
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license
23
+ Dynamic: license-file
24
+ Dynamic: requires-dist
25
+ Dynamic: summary
26
+
27
+ Package for NLP (Natural Language Processing) in Python
@@ -0,0 +1,91 @@
1
+ # py_nlp
2
+
3
+
4
+ ## Python NLP (Natural Language Processing)
5
+
6
+ NLP utilities in Python
7
+
8
+ A package for numerical NLP in Python
9
+
10
+ ## Author
11
+ * Aliou Diouf,
12
+ * Graduated from Paul Sabatier Toulouse 3, University, in
13
+ * Applied Mathematics, speciality Scientific Computing:
14
+ * Numerical Analysis, PDE, Software Engineering, Images processing, Signal processing,
15
+ Aerospace, HR, English...
16
+
17
+ * CEO and Founder of Diouf Tech, a STEM (Science, Technology, Engineering, Mathematics) company,
18
+ headquartered in Paris
19
+
20
+ * E-mail: aliou.diouf5@gmail.com
21
+ * My LinkedIn: https://www.linkedin.com/in/aliou-diouf-7b980441b/
22
+ * My personal Facebook: https://www.facebook.com/aliou.diouf.587/
23
+
24
+ ## Our product
25
+
26
+ * https://www.mathgame-py.com
27
+
28
+ ## Company: Diouf Tech
29
+
30
+ * PayPal: https://www.paypal.com/paypalme/mathgamepy
31
+ * Facebook page: https://www.facebook.com/profile.php?id=100086476192955
32
+ * address: 149, Avenue du Maine, 75014 Paris, France
33
+ * Location: France
34
+ * Target: Worldwide
35
+
36
+ ## Test and Deploy
37
+
38
+ * Tests: py_nlp/tests
39
+ * All tests must pass. However, some tests may be environment (computer, OS, Python...) precision dependant.
40
+
41
+ * If you need consultant, feel free to e-mail: aliou.diouf5@gmail.com
42
+ * For deployment, we are AWS-oriented
43
+ * We prefer empty EC2 server. We can scale it over the time according to usage
44
+
45
+ ***
46
+
47
+ # This README
48
+
49
+ Describes py_nlp idea, goal, context, usages ...
50
+
51
+ ## Suggestions
52
+
53
+ Read it entirely.
54
+
55
+ ## py_nlp
56
+ py_nlp stands for Python NLP, where NLP stands for Natural Language Processing.
57
+
58
+ ## Description
59
+ A package for numerical NLP in Python, can be used in Artificial Intelligence (AI).
60
+
61
+ ## Visuals
62
+ Diouf Tech logo.
63
+
64
+ ## Installation
65
+ * pip install py_nlp
66
+ * Locally: pip install .
67
+
68
+ ## Usages
69
+ * import py_nlp
70
+ * from py_nlp.src.dir_name.file_name import the_function_you_want
71
+ * For tests: pytest
72
+
73
+ ## Support
74
+ E-mail to: aliou.diouf5@gmail.com
75
+
76
+ ## Roadmap
77
+ Under development
78
+
79
+ ## Contributing
80
+ * We cannot invite people without financial support.
81
+ * We prefer financial support:
82
+ * PayPal: https://www.paypal.com/paypalme/mathgamepy
83
+
84
+ ## Authors and acknowledgment
85
+ Aliou Diouf (aliou.diouf5@gmail.com)
86
+
87
+ ## License
88
+ Diouf Tech License.
89
+
90
+ ## Project status
91
+ Ongoing
@@ -0,0 +1,27 @@
1
+ Metadata-Version: 2.4
2
+ Name: natlangproc
3
+ Version: 1.0.0
4
+ Summary: Package for NLP (Natural Language Processing) in Python
5
+ Home-page: https://www.paypal.com/paypalme/mathgamepy
6
+ Author: Aliou Diouf
7
+ Author-email: aliou.diouf5@gmail.com
8
+ License: Diouf Tech
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: License :: Free To Use But Restricted
11
+ Classifier: Programming Language :: Python :: 3.14
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENCE.txt
14
+ Requires-Dist: flake8
15
+ Requires-Dist: pytest
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license
23
+ Dynamic: license-file
24
+ Dynamic: requires-dist
25
+ Dynamic: summary
26
+
27
+ Package for NLP (Natural Language Processing) in Python
@@ -0,0 +1,13 @@
1
+ LICENCE.txt
2
+ README.md
3
+ setup.py
4
+ natlangproc.egg-info/PKG-INFO
5
+ natlangproc.egg-info/SOURCES.txt
6
+ natlangproc.egg-info/dependency_links.txt
7
+ natlangproc.egg-info/requires.txt
8
+ natlangproc.egg-info/top_level.txt
9
+ py_nlp/__init__.py
10
+ py_nlp/data/inputs/en_stopwords_list.py
11
+ py_nlp/data/inputs/fr_stopwords_list.py
12
+ py_nlp/src/text_keywords.py
13
+ py_nlp/tests/test_text_keywords.py
@@ -0,0 +1,2 @@
1
+ flake8
2
+ pytest
@@ -0,0 +1 @@
1
+ py_nlp
File without changes
@@ -0,0 +1,6 @@
1
+ # This is just to get a clue. Create your own list.
2
+
3
+ [
4
+ 'the', 'Your', 'the', 'of', 'and', 'i', 'prime', 'on', '-', 'to', 'in',
5
+ 'my', 'how', 'you', 'also', 'a', 'if', 'have', 'is', 'an', 'it'
6
+ ]
@@ -0,0 +1,8 @@
1
+ # This is not enough, it is just to get a clue. Create your own list.
2
+
3
+ [
4
+ 'de', 'et', 'les', 'le', 'est', 'par', 'en', 'la', 'ã', 'plus', 'elle',
5
+ 'qui', 'ses', 'à', 'a', 'tous', 'pour', 'cette', 'du', 'des', 'sur', 'ne',
6
+ 'ce', 'sont', 'au', 'dans', 'un', 'sera', 'eux,', 'que', 'leurs', 'avec',
7
+ 'ces', 'ça', 'leur', 'une', 'soit', 'ils', 'il'
8
+ ]
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ r"""
4
+ Keywords from French or English text
5
+ /!\ This script will never be better than human brain
6
+ Author: Aliou Diouf - Master degree in Applied Mathematics,
7
+ speciality Scientific Computing (Numerical Analysis, PDE, Software Engineering,
8
+ Images processing, Signal processing, Aerospace, HR, English...)
9
+ from Paul Sabatier Toulouse 3 University,
10
+ CEO and Founder of Diouf Tech, a STEM company headquartered in Paris (75014)
11
+ Products: www.mathgame-py.com, https://www.paypal.com/paypalme/mathgamepy
12
+ Facebook page: https://www.facebook.com/profile.php?id=100086476192955
13
+ Personal Facebook: https://www.facebook.com/aliou.diouf.587/
14
+ LinkedIn: https://www.linkedin.com/in/aliou-diouf-7b980441b/
15
+ STEM stands for: Science, Technology, Engineering, Mathematics
16
+ My PyPI packages:
17
+ https://pypi.org/project/py-ci-cd,
18
+ https://pypi.org/project/pymeshing
19
+ https://pypi.org/project/passwordworld
20
+ https://pypi.org/project/py-num-math/
21
+ """
22
+
23
+ import os
24
+ from sys import argv
25
+ from string import punctuation
26
+
27
+
28
+ def text_keywords(text, sort=False, nb_keywords=None):
29
+ """Provides the most relevant keywords of text"""
30
+
31
+ text_lower = text.lower()
32
+ dir_path = os.path.dirname(os.path.realpath(__file__))
33
+ inputs = os.path.join(dir_path, '../data/inputs')
34
+
35
+ # You may review these conditions
36
+ if 'é' in text_lower or 'è' in text_lower or 'ê' in text_lower \
37
+ or 'ù' in text_lower or 'î' in text_lower or 'ï' in text_lower \
38
+ or 'û' in text_lower or 'à' in text_lower or 'â' in text_lower \
39
+ or 'une ' in text_lower or 'il ' in text_lower \
40
+ or 'elle ' in text_lower:
41
+ stopwords_filename = 'fr_stopwords_list.py'
42
+ else:
43
+ # Default is English
44
+ stopwords_filename = 'en_stopwords_list.py'
45
+
46
+ with open(os.path.join(inputs, stopwords_filename), encoding='utf-8') as f:
47
+ stopwords = eval(f.read())
48
+ words_dict = {}
49
+
50
+ for item in text_lower.split():
51
+ try:
52
+ word = item.split("'")[1]
53
+ except IndexError:
54
+ word = item
55
+ word = word.translate(str.maketrans('', '', punctuation)).strip()
56
+ if word and word not in stopwords:
57
+ words_dict[word] = words_dict.get(word, 0) + 1
58
+
59
+ if sort:
60
+ sorted_tuples_list = sorted(words_dict.items(), key=lambda tup: tup[1],
61
+ reverse=True)
62
+ if nb_keywords:
63
+ return [t[0] for t in sorted_tuples_list[:nb_keywords]]
64
+ else:
65
+ return sorted_tuples_list
66
+
67
+ return list(words_dict.items())
68
+
69
+
70
+ def usage():
71
+ """Usage for main program"""
72
+
73
+ print(f'Usage: {argv[0]} sort-nb_most_relevant_words filename_abs_path\n')
74
+ exit()
75
+
76
+
77
+ if __name__ == '__main__':
78
+
79
+ print()
80
+
81
+ if '--help' in argv or '-h' in argv:
82
+ usage()
83
+
84
+ try:
85
+ text_filename = argv[1]
86
+ except IndexError:
87
+ usage()
88
+
89
+ with open(text_filename, encoding='utf-8') as f:
90
+ text = f.read()
91
+
92
+ for arg in argv:
93
+ if 'sort' in arg:
94
+ sort = True
95
+ try:
96
+ nb_keywords = int(arg.split('-')[1])
97
+ print(text_keywords(text, sort, nb_keywords), '\n')
98
+ except (IndexError, ValueError):
99
+ print(text_keywords(text, sort), '\n')
100
+ exit()
101
+
102
+ keywords_list = text_keywords(text)
103
+ print(f'{keywords_list}')
104
+ print('\nnb_keywords =', len(keywords_list))
105
+
106
+ print()
@@ -0,0 +1,79 @@
1
+ """
2
+ Tests text_keywords
3
+ These are minimal tests.
4
+ You can add more tests or execute the main program of text_keywords
5
+ Author: Aliou Diouf - Master degree in Applied Mathematics,
6
+ speciality Scientific Computing (Numerical Analysis, PDE, Software Engineering,
7
+ Images processing, Signal processing, Aerospace, HR, English...)
8
+ from Paul Sabatier Toulouse 3 University,
9
+ CEO and Founder of Diouf Tech, a STEM company headquartered in Paris (75014)
10
+ Products: www.mathgame-py.com, https://www.paypal.com/paypalme/mathgamepy
11
+ Facebook page: https://www.facebook.com/profile.php?id=100086476192955
12
+ Personal Facebook: https://www.facebook.com/aliou.diouf.587/
13
+ LinkedIn: https://www.linkedin.com/in/aliou-diouf-7b980441b/
14
+ STEM stands for: Science, Technology, Engineering, Mathematics
15
+ My PyPI packages:
16
+ https://pypi.org/project/py-ci-cd,
17
+ https://pypi.org/project/pymeshing
18
+ https://pypi.org/project/passwordworld
19
+ https://pypi.org/project/py-num-math/
20
+ """
21
+
22
+ from py_nlp.src.text_keywords import text_keywords
23
+
24
+
25
+ def test_text_keywords_without_sort_en():
26
+ """Unit test of text_keywords, without sort", English version"""
27
+
28
+ text = 'It tests "text keywords" function'
29
+ expected = [('tests', 1), ('text', 1), ('keywords', 1), ('function', 1)]
30
+
31
+ assert text_keywords(text) == expected
32
+
33
+
34
+ def test_text_keywords_with_sort_without_nb_keywords_en():
35
+ """Unit test of text_keywords,with sort but without nb_keywords, English"""
36
+
37
+ text = 'Work, work, work, work, and work smartly'
38
+ expected = [('work', 5), ('smartly', 1)]
39
+
40
+ assert text_keywords(text, sort=True) == expected
41
+
42
+
43
+ def test_text_keywords_with_sort_and_nb_keywords_en():
44
+ """Unit test of text_keywords with sort and nb_keywords, English version"""
45
+
46
+ text = 'Work, work, work, work, and work smartly'
47
+ expected = ['work']
48
+
49
+ assert text_keywords(text, sort=True, nb_keywords=1) == expected
50
+
51
+
52
+ def test_text_keywords_without_sort_fr():
53
+ """Unit test of text_keywords, without sort, French version"""
54
+
55
+ text = 'Il teste "text keywords" fonction'
56
+ expected = [('teste', 1), ('text', 1), ('keywords', 1), ('fonction', 1)]
57
+
58
+ assert text_keywords(text) == expected
59
+
60
+
61
+ def test_text_keywords_with_sort_without_nb_keywords_fr():
62
+ """Unit test of text_keywords,with sort but without nb_keywords"""
63
+
64
+ text = 'Travailler, beaucoup travailler, toujours travailler,' \
65
+ ' encore travailler'
66
+ expected = [('travailler', 4), ('beaucoup', 1), ('toujours', 1),
67
+ ('encore', 1)]
68
+
69
+ assert text_keywords(text, sort=True) == expected
70
+
71
+
72
+ def test_text_keywords_with_sort_and_nb_keywords_fr():
73
+ """Unit test of text_keywords with sort and nb_keywords"""
74
+
75
+ text = 'Travailler, beaucoup travailler, toujours travailler,' \
76
+ ' encore travailler'
77
+ expected = ['travailler']
78
+
79
+ assert text_keywords(text, sort=True, nb_keywords=1) == expected
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,22 @@
1
+ from setuptools import setup
2
+
3
+
4
+ setup(
5
+ name='natlangproc',
6
+ version='1.0.0',
7
+ description='Package for NLP (Natural Language Processing) in Python',
8
+ long_description='Package for NLP (Natural Language Processing) in Python',
9
+ long_description_content_type="text/markdown",
10
+ url='https://www.paypal.com/paypalme/mathgamepy',
11
+ author='Aliou Diouf',
12
+ author_email='aliou.diouf5@gmail.com',
13
+ license='Diouf Tech',
14
+ packages=['py_nlp', 'py_nlp.src', 'py_nlp.tests', 'py_nlp.data',
15
+ 'py_nlp.data.inputs'],
16
+ install_requires=['flake8', 'pytest'],
17
+ classifiers=[
18
+ 'Development Status :: 5 - Production/Stable',
19
+ 'License :: Free To Use But Restricted',
20
+ 'Programming Language :: Python :: 3.14'
21
+ ]
22
+ )