Code Monkey home page Code Monkey logo

markovipy's Introduction

markovipy

image

image

Documentation Status

Updates

logo

She 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.

I wrote a blog post explaining the motivation and what is there behind the scenes if you are interested

Demo

Demo

Installation

To install markovipy, run this command in your terminal:

$ pip install markovipy

This is the preferred method to install markovipy, as it will always install the most recent stable release.

If you don't have pip installed, this Python installation guide can guide you through the process.

Usage

To 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."

Features

  • More 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.

Donation

If you have found my little bits of software being of any use to you, do consider helping me pay my internet bills :)

Paypal badge

Instamojo

gratipay

patreon

markovipy's People

Contributors

pyup-bot avatar tasdikrahman avatar vladcalin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

markovipy's Issues

No module named utils

  • markovipy version:
  • Python version:
  • Operating System:

Description

from markovipy.markovipy import MarkoviPy

obj = MarkoviPy("test.txt", 30)

obj.generate_sentence()
obj.generate_sentence()

What I Did

    from markovipy.markovipy import MarkoviPy
  File "C:\Python27\lib\site-packages\markovipy\__init__.py", line 3, in <module
>
    from .markovipy import MarkoviPy
  File "C:\Python27\lib\site-packages\markovipy\markovipy.py", line 8, in <modul
e>
    from markovipy.utils import get_word_list
ImportError: No module named utils

Co count proba

  • markovipy version:
  • Python version:
  • Operating System:

Description

would it be possible to user input the co-count probability ?

Such overall proba is satistfied.

Option to specify number of sentences to be generated

  • markovipy version: 0.2.0
  • Python version: 3.6.1
  • Operating System: Sierra

Description

As of now, the API looks something like this

>>> from markovipy.markovipy import MarkoviPy
>>>
>>> obj = MarkoviPy("/Users/tasrahma/development/projects/markovipy/corpus/shakespeare/hamlet_utf8.txt", 3)
>>> obj.generate_sentence()

We can add an option to generate the number of sentences in the method generate_sentence()

Good library

Have some feature that will be made?
Or a enhancement..

Some text to process to improve results..

Expose important classes in root module

I was wondering if the most important classes/functions that the user will use should be exposed in the markovipy module.

The importing of the MarkoviPy class would look like

from markovipy import MarkoviPy

rather than

from markovipy.markovipy import MarkoviPy

Also, in the future, as more relevant functionality will be added, it will be more straight forward for a new user to look for them in the documentation of the marokovipy module.

Any opinions on this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.