Saravanan666/pypi-org huggingface dataset:
Package: persian-phonemizer
persian_phonemizerA tool for translating Persian text to IPA (International Phonetic Alphabet).In Persian, one written word can have different pronunciations and different meanings according to the pronunciation.
This library helps with disambiguation of such words.A few examples of use cases of this library are:Input for TTS systemsHelping people in learning PersianAdding pronunciation for Persian words in texts of other languagesInstallationpip install persian_phonemizerUsageFast start:>>> from persian_phonemizer import Phonemizer
>>> phonemizer = Phonemizer()
>>> phonemizer.phonemize("آن مرد مرد.")
'ʔɒːn mæɾd moɾd .'
>>> phonemizer.phonemize("دوچرخه جدید علی گم شد.")
'dovtʃʰæɾxeje dʒædiːde ʔæliː ɡom ʃod .'you can set the package to output Persian text with eraab instead of IPA:>>> phonemizer = Phonemizer(output_format='eraab')
>>> phonemizer.phonemize("آن مرد مرد.")
'آن مَرد مُرد .'What's inside?A database containing words, part-of-speech, pronunciation and meaning according to Moen dictionaryscript for parsing Dehkhoda dictionary is available in the dataset directory. Still, the results are not used in the package because some pronunciations are outdated and will do more harm than good.A Part-of-Speech tagger and a Dependency Parser trained onUniversal Dependenciesdataset usingspaCyA Grapheme to Phoneme model using a seq-to-seq neural network implemented in Pytorch. More info is provided ing2p_farepo.
These assets were created to be used in this repo but each one has the ability to be used separately.How does it work?This package uses several approaches for finding the proper pronunciation.Input text gets normalized and tokenizedRoot word for each word in input is calculated using a lemmatizer to cover complex verbs and nounsEach word is looked up for pronunciations in the database.If there is no pronunciation available, pronounce is predicted usingg2p_fa.If there is one pronunciation, that one is used.If there is more than one pronunciation, the correct one is chosen based on the Part-of-Speech tag for that word.Suffix and prefix pronunciations are added for each wordAddeorjebetween words when needed using the dependency parser
Package: persian-sa
Persian Sentiment AnalysisA trained model to predict sentiment class of a given Persian text.Installationpip3installpersian_saRead More:To find about preprocessing and feature engineering, and how the model predicts visitarXiv.Usage:Running the source codeTo run the program, use python3 persian_sa.pyNext you will be prompted to give a Persian text as input.To exit the program writeexiton terminal.MOHAMMADs:persian_samohammadkasra$python3persian_sa.pyThisappusesMLtopredictsetntiment(e.g.,PositiveorNegative)ofagivenPersiantext.Toexittheappwrite'exit'interminal.


Input:زیاددرخاطراتدیگرانورودنکنید،چراکهدرخاطراتهرشخصرازهاییوجودداردکهحتیمیترسدآنهارابرایخودشآشکارکند!
...Negative!


Input:زندگیهمچونیکآینهاستزمانیکهدرآنلبخندبزنیمشگفتانگیزتریننتایجرابهدستخواهیمآورد
...Positive!


Input:exit...exit:0MOHAMMADs:persian_samohammadkasra$Running with after Pip install>>>frompersian_sa.persian_saimportpersian_sa>>>>>>persian_sa.predict_sentiment('می تواند به همین دلیل از آن متنفر باشد')'Negative!'>>># Or you can predict the class number; if you set "return_class_label = True">>>persian_sa.predict_sentiment('می تواند به همین دلیل از آن متنفر باشد',return_class_label=True)0>>>persian_sa.predict_sentiment('اجرای آنها شادی مطلق است')'Positive!'>>>persian_sa.predict_sentiment('اجرای آنها شادی مطلق است',return_class_label=True)1>>>CHANGE LOG:++++++++++++++++++++++CHANGE LOG+++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++..... Version 0.2.3 -->  26.01.2021  -->  1st Release
|  	     |		   |
|		     |		   |
|		     |		   |
.....................................................
Package: persiantools
PersianToolsJalali (Shamsi) date and datetime (based on python datetime's module)Convert Jalali to Gregorian date/datetime and vice versaSupport comparison and arithmetic operators such as+,-,==,>=Support timezoneConvert Arabic and Persian characters/digits to each otherConvert numbers to wordsInstall Packagepython-mpipinstallpersiantoolsPersiantools supports Python 3.6+. (for python 2.7 and 3.5 use1.5.xversion)How to useDate>>>frompersiantools.jdatetimeimportJalaliDate>>>importdatetime>>>JalaliDate.today()JalaliDate(1395,4,18,Jomeh)>>>JalaliDate(1369,7,1)JalaliDate(1369,7,1,Yekshanbeh)>>>JalaliDate(datetime.date(1990,9,23))# Gregorian to JalaliJalaliDate(1369,7,1,Yekshanbeh)>>>JalaliDate.to_jalali(2013,9,16)# Gregorian to JalaliJalaliDate(1392,6,25,Doshanbeh)>>>JalaliDate(1392,6,25).to_gregorian()# Jalali to Gregoriandatetime.date(2013,9,16)>>>JalaliDate.fromtimestamp(578707200)# Timestamp to JalaliJalaliDate(1367,2,14,Chaharshanbeh)Datetime>>>frompersiantools.jdatetimeimportJalaliDateTime>>>importdatetime,pytz>>>JalaliDateTime.now()JalaliDateTime(1395,4,18,1,43,24,720505)>>>JalaliDateTime.now().to_gregorian()# Jalali to Gregoriandatetime.datetime(2016,7,8,1,43,24,720505)>>>JalaliDateTime.to_jalali(datetime.datetime(1988,5,4,14,0,0,0))# Gregorian to JalaliJalaliDateTime(1367,2,14,14,0)>>>JalaliDateTime.fromtimestamp(578723400,pytz.timezone("Asia/Tehran"))# Timestamp to JalaliJalaliDateTime(1367,2,14,8,0,tzinfo=<DstTzInfo'Asia/Tehran'+0330+3:30:00STD>)>>>JalaliDateTime.now(pytz.utc)JalaliDateTime(1395,4,17,21,23,53,474618,tzinfo=<UTC>)FormatBased on pythonstrftime()behavior>>>frompersiantools.jdatetimeimportJalaliDate,JalaliDateTime>>>importpytz>>>JalaliDate(1367,2,14).isoformat()'1367-02-14'>>>JalaliDate(1395,3,1).strftime("%Y/%m/%d")'1395/03/01'>>>JalaliDateTime(1369,7,1,14,0,10,0,pytz.utc).strftime("%c")'Yekshanbeh 01 Mehr 1369 14:00:10'>>>JalaliDateTime.now(pytz.utc).strftime("%I:%M:%S.%f%p %z %Z")'01:49:22.518523 PM +0000 UTC'Digits/Characters Tools>>>frompersiantoolsimportcharacters,digits>>>digits.en_to_fa("0987654321")'۰۹۸۷۶۵۴۳۲۱'>>>digits.ar_to_fa("٠٩٨٧٦٥٤٣٢١")'۰۹۸۷۶۵۴۳۲۱'>>>digits.fa_to_en("۰۹۸۷۶۵۴۳۲۱")'0987654321'>>>digits.to_word(9512026)'نه میلیون و پانصد و دوازده هزار و بیست و شش'>>>digits.to_word(15.007)'پانزده و هفت هزارم'>>>characters.ar_to_fa("كيك")'کیک'Operators>>>frompersiantools.jdatetimeimportJalaliDate,JalaliDateTime>>>importdatetime>>>JalaliDate(1367,2,14)==JalaliDate(datetime.date(1988,5,4))True>>>JalaliDateTime(1367,2,14,4,30)>=JalaliDateTime(1369,7,1,1,0)False>>>JalaliDate(1367,2,14)==datetime.date(1988,5,4)True>>>JalaliDate(1395,2,14)+datetime.timedelta(days=38)JalaliDate(1395,3,21,Jomeh)>>>JalaliDateTime(1395,12,30)-JalaliDateTime(1395,1,1)datetime.timedelta(365)Serializing and de-serializing>>>frompersiantools.jdatetimeimportJalaliDate>>>importpickle>>># Serializing>>>file=open("save.p","wb")>>>pickle.dump(JalaliDate(1367,2,14),file)>>>file.close()>>># de-serializing>>>file=open("save.p","rb")>>>jalali=pickle.load(file)>>>file.close()>>>jalaliJalaliDate(1367,2,14,Chaharshanbeh)
Package: persianutils
PersianUtilsA wonderful package to preprocess your Persian text for Search, Standardizing & NLP processes.Why PersianUtils?Persian has a lot of duplicate characters with Arabic but with different Unicode code points. This may lead to different writings of a word, with almost exactly the same appearance. In addition to that, contextual forms of a character may also be used in text, which doesn't change the word shape but makes the same trouble mentioned above. Unfortunately, a lot of non-standard Persian keyboards don't obey these rules, which makes the problem more severe. This package helps to make your Persian text a standard one, with original Persian characters.InstallationTo install PersianUtils, you can use pip:pip install persianutilsUsageThere are two functions implemented for standardizing Persian text named "standardize" and "standardize4Word2vec".standardize()This function does the following:Replace Arabic characters with their Persian equivalent. Likefrom persianutils.ArabicAlphabet import ALEF_MAKSURAtofrom persianutils.PersianAlphabet import YERemove Tanveens like ـٍ , ـَ , & etc.Replace contextual forms of a character to its original form. Like "ـتـ‎" to "ت".Replace western and eastern numerals to their Persian equivalent.2to۲Example:import persianutils as pu
raw_text = "سلامٌ علیکم!"
processed_text = pu.standardize(raw_text)
print(processed_text)That would result in:سلام علیکم!standardize4Word2vec()This function has these features:Same as the standardize() #1Same as the standardize() #2Same as the standardize() #3Replace all numerals (Eastern, Western and Persian) to their Persian writings.2toدوReplaces all punctuation marks with single space. Punctuations are:[!"#%\'()*+,-./:;<=>?@\[\]^_`{|}~’”“′‘\\\]؟؛«»،٪Example:import persianutils as pu
raw_text = "سلامٌ علیکم!"
processed_text = pu.standardize4Word2vec(raw_text)
print(processed_text)This would result in:سلام علیکمPersian & Arabic CharactersThere is also a list of Persian & Arabic characters, accessible frompersianutils.PersianAlphabet:from persianutils.PersianAlphabet import ALEF, BE, PE, TEOr for Arabic:from persianutils.ArabicAlphabet import ALEF_HAMZA_ABOVE_FINAL, HAMZA_ABOVE_ALEFContributingWe appreciate all contributions. If you're interested in contributing, please start by reading ourContributing Guide.
Package: persim
Persim is a Python package for many tools used in analyzing Persistence Diagrams.  It currently houses implementations ofPersistence ImagesPersistence LandscapesBottleneck distanceModified Gromov–Hausdorff distanceSliced Wasserstein KernelHeat KernelDiagram plottingSetupThe latest version of persim can be found on Pypi and installed with pip:pip install persimDocumentation and UsageDocumentation about the library, it's API, and examples of how to use it can be found atpersim.scikit-tda.org.ContributionsWe welcome contributions of all shapes and sizes. There are lots of opportunities for potential projects, so please get in touch if you would like to help out. Everything from an implementation of your favorite distance, notebooks, examples, and documentation are all equally valuable so please don't feel you can't contribute.To contribute please fork the project make your changes and submit a pull request. We will do our best to work through any issues with you and get your code merged into the main branch.
Package: persine
Persine, the Persona EnginePersine is anautomated tool to study and reverse-engineer algorithmic recommendation systems. It has a simple interface and encourages reproducible results. You tell Persine to drive around YouTube and it gives back a spreadsheet of what else YouTube suggests you watch!Persine =>Pers[ona Eng]ineFor example!People have suggested that if you watch a few lightly political videos, YouTube starts suggesting more and more extreme content –but does it really?The theory is difficult to test since it involves a lot of boring clicking and YouTube already knows what you usually watch.Persine to the rescue!Persine starts a new fresh-as-snow ChromeYou provide a list of videos to watch and buttons to click (like, dislike, "next up" etc)As it watches and clicks more and more, YouTube customizes and customizesWhen you're all done, Persine will save your winding path and the video/playlist/channel recommendations to nice neat CSV files.Beyond analysis, these files can be used to repeat the experiment again later, seeing if recommendations change by time, location, user history, etc.If you didn't quite get enough data, don't worry – you can resume your exploration later, picking up right where you left off. Since each "persona" is based on Chrome profiles, all your cookies and history will be safely stored until your next run.An actual exampleSee Persine in actionon Google Colab.Includes a few examples for analysis, too.Installationpip install persinePersine will automatically install Selenium and BeautifulSoup for browsing/scraping, pandas for data analysis, and pillow for processing screenshots.You will need to manually install chromedriver to allow Selenium to control Chrome.See details hereQuickstartIn this example, we start a new session by visiting a YouTube video and clicking the "next up" video three times to see where it leads us. We then save the results for later analysis.frompersineimportPersonaEngineengine=PersonaEngine(headless=False)withengine.persona()aspersona:persona.run("https://www.youtube.com/watch?v=hZw23sWlyG0")persona.run("youtube:next_up#3")persona.history.to_csv("history.csv")persona.recommendations.to_csv("recs.csv")We turn off headless mode because it's fun to watch!More examples, more features, more everythingFind the complete documentation here
Package: persis
An example of including non-code files in a package.Project structurepersis
├── AUTHORS.rst
├── CHANGELOG.rst
├── LICENSE.txt
├── Makefile
├── README.rst
├── docs
│   ├── Makefile
│   ├── _static
│   ├── authors.rst
│   ├── changelog.rst
│   ├── conf.py
│   ├── index.rst
│   └── license.rst
├── requirements.txt
├── setup.cfg
├── setup.py
├── src
│   └── persis
│       ├── __init__.py
│       └── persis.py
└── tests
    ├── conftest.py
    └── test_persis.pyNoteThis project has been set up using PyScaffold 3.1 and Cookiecutter 1.6.For details and usage information on PyScaffold, seehttps://pyscaffold.org/.For details and usage information on Cookiecutter, seehttps://cookiecutter.readthedocs.io/.
Package: persist
Persistent Archival of Python ObjectsPersistent archival of python objects in an importable format.This package provides a method for archiving python objects to disk for long-term persistent storage.  The archives are importable python packages with large data stored in thenpynumpy data format, orHDF5files using theh5pypackage (if it is installed). The original goal was to overcomes several disadvatages of pickles:Archives are relatively stable to code changes.  Unlike pickles, changing the underlying code for a class will not change the ability to read an archive if the API does not change.In the presence of API changes, the archives can be edited by hand to fix them since they are simply python code.  (Note: for reliability, the generated code is highly structured and not so "pretty", but can still be edited or debugged in the case of errors due to API changes.)Efficient storage of large arrays.Safe for concurrent access by multiple processes.Documentation:http://persist.readthedocs.orgSource:https://alum.mit.edu/www/mforbes/hg/forbes-group/persistIssues:https://alum.mit.edu/www/mforbes/hg/forbes-group/issuesInstallingThis package can be installed fromPyPI:python3-mpipinstallpersistor from source:python3-mpipinstallhg+https://alum.mit.edu/www/mforbes/hg/forbes-group/persist
Package: persisted
PersistedPersisted is a two-way code/data persistence framework.
It can update a variable when a watched file changes, and also save data back to the file when the variable changes.>>>importpersisted>>>data=persisted.as_string('README.md','')>>>data.get()"# Persisted\n\nPersisted is a two-way...">>>withdata:data.value="Change to this">>>data.get()"Change to this"This is very useful to keep configuration files / application state synchronized within a long-running application, and also hot-reload code / modules.Installing$python-mpipinstallpersistedUsageThere are several helper functions for you to get started:persisted.as_bytespersisted.as_stringpersisted.as_picklepersisted.as_module(only reloading)All of them callpersisted.Persistedto create a Persisted object to interact with.
Package: persistedstate
PersistedStateSimple and fast solution for persisting small states:frompersistedstateimportPersistedStateSTATE=PersistedState("example.state",last_id=0)forcurrent_idinrange(STATE.last_id+1,100_001):print(f"Processing item #{current_id}")STATE.last_id=current_idprint("Processing DONE.")You can interrupt this script, and next time it will continue from the first unprocessed item.
As another example seeperftest.py.Mapped YAML state fileThe use case is persisting small amount of data which can be edited easily with a text editor.
The database is an UTF-8 encoded YAML file, so it can be highlighted and edited manually if needed.
(It also uses YAML stream file format for journal.)
The YAML file is fully mapped to Python objects, so every change is synchronized to disk immediately. E.g. you can do this:STATE=PersistedState("state.yaml",processed_items=[])STATE.setdefault("key",{})STATE["key"].setdefault("nested",2)STATE.processed_items.append("<some item>")STATE["key"]["nested"]+=1Failure toleranceIt uses Write-Ahead-Logging and atomic vacuum, so there will be no data loss.Thread safeChanging the state is thread safe. You also can use the._thread_lockattribute to make atomic changes:defatomic_increment():withSTATE._thread_lock:STATE.counter+=1PerformanceFor its use case it outperforms existing key-value store modules.
For example incrementing a counter (for the details seeperftest.py):state.counter=0for_inrange(COUNT_TO):state.counter+=1Counting to 10,000 (using Windows and Python 3.11):PersistedState   0.193 sec
DiskCache        1.222 sec
SqliteDict       3.089 sec
PickleDb         8.251 sec
Lmdb            14.944 sec
Shelve          39.771 secThe example seems to be silly, but this is very close to the use case it was developed for. For complex data structures or big amount of data I suggest using other libraries, likeDiskCache. (The rule of thumb is when your state file is too big to be edited easily in your favorite text editor, you may think about using another key-value store library.)
Package: persistent-crypto-dict
This class implements a persistent dictionary using sqlite3 and
encrypts the keys and the values of the dictionary in a way, that
makes it very hard to bruteforce either the key or the values in the
db.example usage::>>> from pcd import PersistentCryptoDict
>>> d=PersistentCryptoDict()
>>> print d
<pcd.PersistentCryptoDict instance at 0x8dcb54c>
>>> print d['my key']
None
>>> d['my key']='secret value'
>>> print d['my key']
secret value
>>> d['my key']='top secret value'
>>> print d['my key']
top secret valueCryptoThe key and the value in the dict is transformed according to the
following algorithm (credit: dnet):Setting valueswe calculate they keyhash - a hmac-sha512(salt,key)we split the key in half, the first half as a hexdigest (ascii),
the second we keep as a binarywe use the second binary half from step 2 of the keyhash to encrypt
the valuewe use the ascii keyhash from step 2 as a key to the database, and
the value is the encrypted result from step 3.Getting valueswe calculate they keyhash - a hmac-sha512(salt,key)we split the key in half, the first half as a hexdigest (ascii),
the second we keep as a binarywe query the database using the ascii keyhash from step 2 as a keywe use the second binary half from step 2 of the keyhash to decrypt
the valueThe database contains only the following pairs of data:(hmac-sha512(key, salt).hexdigest()[:64],                # key
aes256-ofb(hmac-sha512(key, salt).digest()[32:], value)) # valuewe diligently obey Schneier’s law:https://www.schneier.com/blog/archives/2011/04/schneiers_law.html, and
thus we would consider the task to retrieve any meaningful data
without huge rainbow tables from such a database a futile task. :)
Package: persistentdatatools
BRANCHSTATUSmasterdevelopPython Script: persistentdatatoolsDocumentationWritten By: Benjamin P. TrachtenbergIf you have any questions e-mail meContact Information:e_ben_75-python@yahoo.comLinkedIn:Ben TrachtenbergDocker Hub:Docker HubPyPi Page forpersistentdatatoolsRequirementsNothing Specific besides Python 3InstallationFrom source "setup.py install"From pip "pip install persistentdatatools"LanguagesPythonAboutThis is a library used to manipulate, and save data quickly.  It is just a bunch of shortcuts I use quite a bit to manipulate saved data.Functions included in v2.0.0list_to_file(orig_list, file_name, file_location)file_to_list(file_name, file_location)csv_to_dict(file_name, file_location)store_object(file_name, save_key, file_location, object_to_store=None)retrieve_object_from_file(file_name, save_key, file_location)delete_object_from_file(file_name, save_key, file_location)verify_key_in_shelve(file_name, save_key, file_location)remove_spaces(string_item)remove_spaces_add_hyphen(string_item)remove_extra_spaces(string_item)verify_file_exists(file_name, file_location)verify_directory(directory_name, directory_location, directory_create=False)file_name_increase(file_name, file_location)dict_to_csv(orig_dict, file_name, field_names_tuple, file_location)remove_symbol_add_symbol(string_item, remove_symbol, add_symbol)list_files_in_directory(full_directory_path)Functions added in v2.2.2get_keys_from_shelve(file_name, file_location)Update to Functions in v2.2.5retrieve_object_from_file:
Uses get to retrieve key now, will not throw exception if it doesn't existverify_key_in_shelve:
Uses get to retreive key now, will still return True, or FalseFunctions added in v2.2.5split_string_retain_spaces(string)split_strings_in_list_retain_spaces(orig_list)join_split_string(split_string)Functions added in v2.2.6random_line_data(chars_per_line=80)random_data(line_count=1, chars_per_line=80)
Package: persistentdict
persistentdictYet another [1] dictionary backed by Redis DB.We use Redis` 'hash' type [2] and store whole dictionary in one hash.Usage:frompersistentdict.dict_in_redisimportPersistentDictdb=PersistentDict(hash_name="my-persistent-dict")# add key to the db with a valuedb['key']=value# show whole dictionaryprint(db)# iterate over keys & values in dbforkey,valueindb.items():do_something(key)# do sth with key if it is in dbifkeyindb:do_something(key)# delete key from dbdeldb['key']Installation:pip3installpersistentdict[1] Alternatives:persistent-dict,durabledict[2]https://redis.io/topics/data-types-intro#hashesis basically Python's dict, but values can be strings only, so we use json serialization
Package: persistent_pineapple
IntroductionPersistent Pineapple provides a simple interface to save settings for
applications or other modules. The settings file is in the JSON format
for simplicty. A slightly modified JSON format is used to allow for
comments and other creature features. Please read the _json.py file for
more details.DocumentationDocumentation is hosted onpersistetpineapple.readthedocs.orgInstallDownload the tarball and install withpip install <package>.UsageSee the unit tests for more in-depth examples. Here are the basics:Example codesettings = PersistentPineapple('/etc/myapp.json')
print settings.program_name
if settings.debug:
    print "we're in debug mode"
settings.debug = FalseExample settings file (/etc/myapp.json){
    // App settings ///////////////////////////////////////////////////////////

    // Name of the program
    "program_name": "myapp",

    // HTTP POST listener port
    "port": 8009,

    // Debugging stuff
    "debug": true,

    // Logging settings
    "console_log_level": "INFO",
}