Saravanan666/pypi-org huggingface dataset:
Package: marko-backlinks
marko-backlinks🤔 DescriptionThis project provide a markdown to markdown converter that adds aBi-Directional LinkSection at the end of each markdown files that is converted.The project also provide apre-commit hookso you can easily integrate it within your own projects easilyIt relies heavily on theMarkopython package that is the only
Markdown Parser with a Markdown Renderer that I know of.💭 WhyI believe a great amount of information can be extracted from collaborative notes if we take time to structure them correctly.I wanted:To make collaborative notesTo organize the notes in aRoamlike mannerEveryone to be able to navigate through the notes without installing anythingThis system to be easily adopted by a software engineering team.Using git and this converter as a pre-commit, I can easily do all of this ! 🚀🏃 Getting StartedInstallation as a python package with pipConsidering you already have python available. You can simply add thpipinstall--usermarko-backlinksor install withPoetryThen you can see all the option of the CLI usingmarko-backlinks--helpInstallation as a pre-commit hookThis pre-commit hook use the [pre-commit](https://pre-commit.com) tool that you will
need to install.Add the following line to your pre-commit configuration (.pre-commit-config.yaml) at the root of your
repository.repos:-repo:https://github.com/jb-delafosse/marko-backlinksrev:v0.2.3hooks:-id:marko-backlinksargs:['directory-containing-my-markdown']and install the hook usingpre-commit install🛡 LicenseThis project is licensed under the terms of theMITlicense. SeeLICENSEfor more details.📃 Citation@misc{marko-backlinks,
  author = {jb-delafosse},
  title = {Awesome `marko-backlinks` is a Python cli/package created with https://github.com/TezRomacH/python-package-template},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/jb-delafosse/marko-backlinks}}
}CreditsThis project was generated withpython-package-template.
Package: markon
MarkonContinous Time Markov Chain solver for PythonMarkon is a small Python utility for performing analytic solution of CTMCs. Both quantitative and
symbolic analysis is possible.Example:frommarkonimportsolve_ctmc# Define a CTMC as a dict of state-tuples (from_state, to_state) to a transition ratet={('up','down'):1,# Transition rate from 'up' to 'down' is 1('down','up'):5}# Transition rate from 'down' to 'up' is 5# Obtain steady state probabilitiesp=solve_ctmc(t)print(p)will output{'down':1/6,'up':5/6}Individual state probabilities can be obtained, both in exact form or as a single rounded float:print(p['up'])print(float(p['up']))will output5/60.8333333333333334General symbolic analysis can also be done viaSympy:frommarkonimportsolve_ctmcimportsympy# Define Sympy symbolsl,m=sympy.symbols('l, m')t={('up','down'):l,('down','up'):m}# Obtain steady state probabilities with defined orderp=solve_ctmc(t,['up','down'])print(p)will output{'up':m/(l+m),'down':l/(l+m)}We can then use Sympy functionality to substitute valuesvalues=[(l,1),(m,5)]print(p['up'].subs(values))will output5/6Refer to theSympy documentationfor more on how to enable nice formatting of expressions, output to Latex, etc.
Package: marko-namo
Marko-NamoSimple tool to generate random project or business names using a basicMarkov Chainapproach.InstallationInstallmarko-namofrom the Python Package Index:$pipinstallmarko-namoRequirementsPython 3.8+How It WordsThe generator starts by creating a frequency table based on the training words supplied and the n-grams listed. Eg if our training word ishelloand our n-grams are 1 and 2, we'd get a frequency table of:{"h":["e","el"],"he":["l","ll"],"e":["l","ll"],"el":["l","lo"],"l":["l","lo","o",null],"ll":["o",null],"lo":[null,null],"o":[null,null]}It then randomly selects an n-gram from the frequency table as the first letter, randomly selects a following letter and repeats until the word either ends (selects aNone) or reaches the maximum word length.Eg if the first selected letter wasewe might go:e->l->lo-> NoneWhich giveselloHow To RunYou can either create a config file and pass that in or specifiy your parameters in code. To get started, you can utilse theconfig_sample.yml.frommarko_namoimportMarkoNamorandom_name_generator=MarkoNamo("config_sample.yml")created_names,available_domains=random_name_generator.create_random_names()If you'd rather not use a config file then you can run:frommarko_namoimportMarkoNamorandom_name_generator=MarkoNamo(name_length=5,number_of_names=10,training_words=["hello","pineapple","planet"])created_names,available_domains=random_name_generator.create_random_names()ParametersParameterTypeDescriptionnumber_of_namesIntegerNumber of names to attempt to createmaximum_name_lengthIntegerMaximum name length. Note names can be up to length + largest n-gram in lengthn_gramsList of integersThe word segment lengths to consider for learning and generating new words.extensionsList of stringsDomain extensions to check for such as.com,.ai, etctraining_wordsList of stringsWords to learn from and used to generate new, random, words.  There's no limit to the number of words to learn from but too many will slow the program down significantly.Domain Name LookupIf you'd like to check if the domain name (egwww.randomname.com) is available for the generated names then you'll also need a GoDaddy API key. This can be generated at the following:https://developer.godaddy.com/keysYou'll need to provide:API KeyAPI SecretWhether you'd like to use their OTE (test) or PROD (production) environmentBuilding the ProjectThis package usespoetryandnoxfor package management and building.If nox is not already installed, install it:$pipinstallnox$pipinstallnox_poetryRun everything including tests and documentation building$nox#Ortorunaspecificstage:$nox-s<stagename>,eg$nox-stestsTestingNox also handles the tests but you'll require OTE & PROD keys to run the GoDaddy tests.Register with GoDaddy and generate OTE & PROD keysSet them as environment variables:# GoDaddy OTEGODADDY_OTE_KEY=<OTEKey>GODADDY_OTE_SECRET=<OTESecret>GODADDY_OTE_ENV=OTE# GoDaddy ProdGODADDY_PROD_KEY=<ProdKey>GODADDY_PROD_SECRET=<ProdSecret>GODADDY_PROD_ENV=PRODRun the tests:$nox-stestsIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: markos
A simple Markov Chain implementationInstallationInstalling from pip:pip install markosInstalling from source:pip install git+https://github.com/blazaid/markosRequirementsNo requirements for now.DocumentationWIPAuthorsmarkoswas written byBlazaid.ThanksTo you, for using the library, for helping me to make it faster and better, for learn with it and for releasing your
code to make the knowledge and the science open for the rest of humanity.WarningIt has been developed with only python >= 3.5 in mind, so it won’t probably work on lower versions (i.e. no python 2.X
support).Second warningEnglish included in both this document and the code can be devastating for the brain of an average human being. Even so
we, the poor developers, are working hard to write as correctly as possible and learn along the way. The documentation
will be updated as we improve our language proficency as well as we receive critical / suggestions for this.
Package: markout-html
MarkoutA small Python package I made to extract HTML content from web pages. It is very customizable and I made it to fit my needs (extract multiple pages' code to Markdown, but only some HTML tags which I needed). Due to its purpose being able to convert specific HTML tags into a desired Markdown format this script does not generate any standard output, rather, it uses custom tokens specified in a configuration file, so the output can be formatted into any anything.UsageImporting into your codeTo use this package you'll need to install it usingpip:pipinstallmarkout-htmlThen just import it into your code:frommarkout_htmlimport*After that you can use theextract_urlandextract_htmlfunctions:result=extract_url(# HTML page link'http://example.page.com/blog/some_post.html',# Tokens to format each HTML tags contents (you can extract only the ones you want){'p':"\n**{}**"},# Only extract contents inside this tag'article')result=extract_html(# HTML code string'<html>some html code</html>',# Tokens to format each HTML tags contents (you can extract only the ones you want){'p':"\n**{}**"},# Only extract contents inside this tag'article')Using the CLI commandBelow are a few examples with better description on how to use this package command if you don't want to create a Python script!If you just want to extract using a string in the terminal, you can usemarkout_html --extract [string].You can use the commandmarkout_htmlwith the flag--helpfor more info.ConfigurationAll configurations can be found into a single file:.markoutrc.json(you can specify another name in the terminal with the flag--config), if you don't load a configuration file the script will use its default values. There is an example of configuration in the repository root!To specify a different configuration file use:markout_html--config[filename]The configuration file valueslinks-objectof links to be extracted, each link has a destination value (output file).
Example:{"links":{"http://example.page.com/blog/some_post.html":"out/post.md","http://example.page.com/blog/some_other_post.html":"out/other_post.md"}}The example above will get the HTML fromhttp://example.page.com/blog/some_post.htmland extract the results intoout/post.md.only_on-stringthat specify where (which HTML tag) to extract the contents from (e.g. : html, body, main).
Example:{"only_on":"article"}tokens-objectin which each specified HTML tag will be extract into a formatted string and then placed on the output file.
Example:{"tokens":{"header":"# {}","h1":"\n# {}","h2":"\n# {}","b":"\n## {}","li":"+ {}","i":"** {} **","p":"\n{}","span":"{}"}}On the example above, the contents of the HTML tag<header>will be extract into the# {}string, so for example, if we had<header>Some text here!</header>the result would've been# Some text here!(this formats the text into Markdown).ContributionsFeel free to leave your contribution here, I would really appreciate it!
Also, if you have any doubts or troubles using this package just contact me or leave an issue.
Package: markov_autocomplete
Markov AutocompleteHidden Markov Model to generate autocomplete suggestion.How To UseThe model can be trained with your own list of sentences.For instance, if we want to train using the first two paragraphs of Robinson Crusoefrom markov_autocomplete.autocomplete import Autocompletesentences = ["I WAS born in the year 1632, in the city of York, of a good family, though not of that country, my father being a foreigner of Bremen, who settled first at Hull. He got a good estate by merchandise, and leaving off his trade, lived afterwards at York, from whence he had married my mother, whose relations were named Robinson, a very good family in that country, and from whom I was called Robinson Kreutznaer; but, by the usual corruption of words in England, we are now called - nay we call ourselves and write our name - Crusoe; and so my companions always calledme.","I had two elder brothers, one of whom waslieutenant-colonelto an English regiment of foot in Flanders, formerly commanded by the famous Colonel Lockhart, and was killed at the battle near Dunkirk against the Spaniards. What became of my second brother I never knew, any more than my father or mother knew what became ofme."]ac = Autocomplete(model_path = "ngram", sentences = sentences, n_model=3, n_candidates=10,match_model="middle",min_freq=0,punctuations="",lowercase=True)ac.predictions("country")How it worksGiven an input string that consists ofNwordsw_1, …, w_N, the model predicts the following word,w_{N+1}, from the language model.The most probable candidate forw_{N+1}is computed by maximazingP (w_{N+1} | w_N, …, w_{N - O + 2})whereOis the order of the model.Once the best candidate is computed the probability of the whole sentence is approximated with an n-gram modelP (w_1, …, w_N, w_{N+1}) = PROD_i P (w_i | w_{i-N-1}, …, w_{i-1})For instance, for a 2-gram model we haveP( w1, w2, w3, w4) = P(w1) P(w2|w1) P(w3|w2) P(w4|w3)On the other hand, for a 3-gram model we haveP( w1, w2, w3, w4) = P(w1) P(w2|w1) P(w3|w1, w2) P(w4|w2, w3)Higher-order model will be more precise, but at the expense of generating a large list of n-grams, which may negatively impact on storage space and computational time.If the input string contains less words than the order of the model, the autocomplete will compute the most probably n-gram of the same order of the model.
Package: markov-cli
# AbstractCLI for pymarkovchain.# Install:` pip installmarkov-cli`# Examples` shell $markov-cli--filesBiznes_Bez_Mba.txt Platon_Gosudarstvo.txt--encoding='cp1251'--count100--strip--seedБизнес Бизнес – это удовольствие, а прекращение удовольствия – страдание ... `
Package: markovdecisionprocess
Markov Decision ProcessMarkov Decision ProcessMarkov Decision ProcessInstallationpipinstallTODOUsage##################### Parameters #####################parser=argparse.ArgumentParser()parser.add_argument('--sample_time','-Ts',type=float,help='Ts=0.1',default='0.1',required=False)parser.add_argument('--gamma','-gam',type=float,help='gamma=0.9',default='0.9',required=False)parser.add_argument('--x_grid','-xgr',type=int,help='x_grid=5',default='8',required=False)parser.add_argument('--y_grid','-ygr',type=int,help='y_grid=5',default='5',required=False)args=parser.parse_args()params=vars(args)####################################################### Challenge with Markov Decision Process (MDP) ######################################################## pointsP=get_meshgrid_points(params)# TopologyT,S=get_simple_topology_for_regular_grid(params,P)# rewardsR={'38':100}mdp_challenge={'S':S,'R':R,'T':T,'P':P}dict_mdp=start_mdp(params,mdp_challenge)plot_the_result(dict_mdp,mdp_challenge)... should produce:CitationPlease cite following document if you use this python package:TODOImage source:https://www.pexels.com/photo/photo-of-black-and-beige-wooden-chess-pieces-with-white-background-1083355/
Package: markov-draftjs
markov_draftjsDraft.js sample content generated withMarkov chainsofProject Gutenbergbooks.This sample content is meant to be used while testing projects based on Draft.js, in particularDraftailanddraftjs_exporter.WhySample content can be useful to stress-test and benchmark tools built to handle Draft.js content. For the exporter, this is a great way to reliably assess its performance.The content from this repository isn't generated randomly – while the text and metadata values are fake, the content’s structure and the distribution of rich text formatting amongst the text is representative of that of 3 big CMS sites combined.Here are rich text formats used in the content:Blocksunstyledheader-twoheader-threeheader-fourordered-list-item, depth: 0 or 1unordered-list-item, depth: 0 or 1atomicInline stylesBOLDITALICEntitiesLINK,MUTABLEwithurl(URL),linkType(page|external|email), optionallyid(number)DOCUMENT,MUTABLEwithlabel(plain text),id(string containing a number)IMAGE,IMMUTABLEwithtitle(plain text),id(string containing a number),src(URL)HORIZONTAL_RULE,IMMUTABLEwithout dataUsing the sample contentIn order to simplify using the samples across multiple projects, they are published as packages onnpmandPyPI.# JavaScript projects.npminstallmarkov_draftjs# Python projects.pipinstallmarkov_draftjsThen, in JavaScript:constcontentStates=require("markov_draftjs");And in Python:frommarkov_draftjsimportget_content_samplecontent_states=get_content_sample()The sample content is also available from GitHub, eg. with RawGit (warning - big file):https://cdn.rawgit.com/thibaudcolas/markov_draftjs/44827d98/markov_draftjs/content.json.DevelopmentRequirements:virtualenv,pyenv,twinegitclonegit@github.com:thibaudcolas/markov_draftjs.gitcdmarkov_draftjs/# Install the git hooks../.githooks/deploy# Install dependenciesnvminstall
npminstall# Unarchive sample text.cdcorpora/
tar-xzvf*.tar.gzcd..# Install the Python environment.virtualenv.venvsource./.venv/bin/activate
makeinit# Install required Python versionspyenvinstall--skip-existing3.10.0# Make required Python versions available globally.pyenvglobalsystem3.10.0# Generate new sample content.npmrunstartReleasesUseirish-pubto confirm the content of the npm package.Make a new branch for the release of the new version.Update theCHANGELOG.Update the version number inmarkov_draftjs/__init__.py, andpackage.json, following semver.Make a PR and squash merge it.Back on main with the PR merged, usemake publish(confirm, and enter your password) andnpm publish.Finally, go to GitHub and create a release and a tag for the new version.Done!See alsohttps://github.com/jsvine/markovifyhttps://github.com/catseye/Guten-gutter
Package: markov-epidemic
markov_epidemicMarkov stochastic models (SIS, SIR, SEIR...) to describe the evolution of epidemics on a network of connected individuals.This package contains standalone code for simulating epidemics and study the influence of the underlying graph and points to some theoretical results regarding the expected lifetime of an epidemic as a function of its infection/recovery rates and the network topology (in particular its adjacency spectrum).Enjoy while you stay indoors helping us reduce our spectral radius :)
Package: markovgen
InstallationUsing pip:pip3 install markovgen –userOrFrom the git repository:git clonehttps://github.com/ProgVal/markovgen.gitcd markovgenpython3 setup.py install –userCommand-line usageUsage:python3 -m markovgen <extracter> <path to log file>Supported extracters are:srtsupybotweechatxchatplainUsage as a librarymarkovgen.Markov:__init__(messages=[]):takes an optional list of initial messages.feed(message):takes a message and adds it to the cache.feed_from_file(file_descriptor, extracter):Reads the file descriptor line by line, apply the extracter to
it, and feeds the cache with the return value of the extracter.generate_markov_text(max_size=30, seed=None, backward=False):Generate a text based on the cache.
Selects a random word in the cache as the first (resp. last) word,
and continues forward (resp. backward) using the cache in the
right direction, until it selects a message end from the cache
or that the max_size is met.
The seed may be a string or a 2-tuple of strings.available_seeds(backward=False):Returns a view on the 2-tuples of words in the corpus.
Useful if you want to match them against a new message.@mixed_encoding_extracting:decorator for extracters that handle decoding messages with the
right charset (if chardet or charade is installed) or as utf8
(otherwise)
Package: markovianbandit-pkg
Markovian BanditsThis repository contains a python library to compute whittle indices or test indexability of finite-state Markovian bandit problems.InstallationTo install, just run:pip install markovianbandit-pkgExampleTo test with a few randomly generated examples:import markovianbandit as bandit
model = bandit.random_restless(dim=4, seed=42)
print(model.whittle_indices()) # should print array([ 0.87536099, -0.08765819, -0.15279431, -0.51905682])
print(model.get_P0P1R0R1())
model = bandit.random_restless(4, seed=2791)
print(model.is_indexable()) # should print False

model = bandit.random_rested(dim=4)
print(model.gittins_indices(discount=.8)) # computes gittins indexTo compute the Whittle or Gittins index from P0 and P1:P0 = [[.5, .5], [.25, .75]]
P1 = [[1, 0], [0.5, 0.5]]
R0 = [0.5, 0.5]
R1 = [2, 1]
model = bandit.restless_bandit_from_P0P1_R0R1(P0, P1, R0, R1)
print(model.whittle_indices())

model = bandit.rested_bandit_from_P1_R1(P1, R1)
print(model.gittins_indices(discount=0.5))Note that the algorithm complexity to compute Whittle index is $O(n^3)$. It can compute indices of bandits in less than one seconds to bandits of up to $1000$ states (i.e. $1000\times 1000$ matrices). The loop below should take less than one second.import time
for dim in [10, 100, 1000]:
    ts = time.time()
    model = bandit.random_restless(dim=dim, seed=42)
    model.whittle_indices()
    print("Model of size", dim, "computed in", time.time() - ts, "seconds")AuthorsNicolas Gast and Kimang Khun.History version0.3 (July 10, 2023):handle multichain case by testing when matrix inversion failscorrect treatment of possibly infinite indicescorrection of a bug when dividing by 0.addition of an absolute tolerance to be more robust0.2 (Nov 21, 2022)simplification of how the discount is treatedfunction to avoid recomputation of indicesnew indexability test0.1 (Jan 11, 2021)Many small optimization (code about 50% faster)0.0.5 (Nov 19, 2021). First public release.Reference"Testing Indexability and Computing Whittle and Gittins Index in Subcubic Time" by Nicolas Gast, Kimang Khun and Bruno Gaujal.https://arxiv.org/abs/2203.05207
Package: markovipy
markovipyShe tries striking conversations with you with her cohesive sentences after you have given her fill of text to her. And no she won’t complain about how big your corpus is. Also, don’t ask her if she can pass the turing test. She might not talk to you again.Iwrote a blog postexplaining the motivation and what is there behind the scenes if you are interestedInstallationTo install markovipy, run this command in your terminal:$pipinstallmarkovipyThis is the preferred method to install markovipy, as it will always install the most recent stable release.If you don’t havepipinstalled, thisPython installation guidecan guide
you through the process.UsageTo use markovipy in a project:>>> from markovipy import MarkoviPy
>>>
>>> # create MarkoviPy object
>>> obj = MarkoviPy("/Users/tasrahma/development/projects/markovipy/corpus/ts_eliot/Gerontion_utf8.txt", 3)
>>>
>>>
>>> # arguments passed, is the initial corpus file and the markov chain length(defaults to 2 if nothing passed)
>>> obj.generate_sentence()
'Cammel, whirled Beyond the circuit of the shuddering Bear In fractured atoms.'
>>>
>>> obj.generate_sentence()
'After such knowledge, what forgiveness? Think now History has many cunning passages, contrived corridors And issues, deceives with whispering ambitions, Guides us by vanities.'
>>>
>>> obj.generate_sentence()
'Gull against the wind, in the windy straits Of Belle Isle, or running on the Horn, White feathers in the snow, the Gulf claims, And an old man, a dull head among windy spaces.'
>>>
>>> obj.generate_sentence()
'Silvero With caressing hands, at Limoges Who walked all night in the field overhead; Rocks, moss, stonecrop, iron, merds.'
>>>
>>> obj.generate_sentence()
"Gives too soon Into weak hands, what's thought can be dispensed with Till the refusal propagates a fear."Free software: GNU General Public License v3Documentation:https://markovipy.readthedocs.io.FeaturesMore tests to be added. As of now, some minimal tests have been written. Contributions more than welcome.Create a web-interface with some fancy buttons/UI which would give you random quotes.LinksBlog postHistory0.3.0(2017-05-30)exposed theMarkovipyclass in themarkovipymodule.
API changed fromfrom markovipy.markovipy import MarkoviPytofrom markovipy import MarkoviPy0.2.0 (2017-04-29)self.middle_valuemapping becomes adefaultdictlist_to_tuple()was removed to use just thetuple()movedself.words_list = get_word_list(self.filename)to__init__()0.1.1 (2017-04-14)fixesUnicodeDecodeErrorwhile reading files instead of using the normalopen()0.1.0 (2017-04-11)First release on PyPI.