Coder Social home page Coder Social logo

textedit's Introduction

✏️ Text Edit in Wonderland ✏️

Alice with Pig

The mini text editor for people who want to focus on learning Python packaging. This text editor lets you:

  • Count the number of words, sentences, and characters in a file
  • Determine the Colman-Liau readabilty index
  • Replace a phrase or string with another phrase
  • Change spacing between sentences from single space period to double space/period and backwards

and not much else.

Installing

These directions are for OSX/Linux-based systems. Windows will be slightly different.

  1. You'll need at least Python 3.5 to run Text Edit.
  2. git clone https://gitlab.com/veekaybee/textedit.git
  3. cd textedit
  4. Run pip install .
  5. That's it! You're ready to use textedit.
  6. If you encounter any issues, export PYTHONPATH="${PYTHONPATH}:/texteditpath" to your ~/.bashrc or Windows equivalent.
  7. Running tests: python -m unittest discover to test basic wordcount functionality.

Prerequisites

Python 3.5

Using the Package API

To import into your Python code:

import textedit

You can run the code interactively:

#Replace

python replace.py ../texts/alice.txt "Vicki" "Dora the Explorer"
Old Wordcount ('Words:', 274)
WC __name__: WC
New Wordcount ('Words:', 281)
parsefile __name__: __main__

#WordCount

mbp-vboykis:review vboykis$ python wordcount.py "../texts/alice.txt"
('Words:', 274)
('Sentences:', 7)
('Letters:', 1120)

# Readability

mbp-vboykis:review vboykis$ python readability.py "../texts/alice.txt"
('Reading Grade Level of Text:', 7)

Or, you can import it and use on a text file:

from review import readability  #import everything in the file named readability
from review.wordcount import WC #import classes specifically
from edit.spacing import Spacing
from edit.replace import Replace


test_file = '../texts/pool_of_tears.txt'

# Count words

print("Wordcount.py")
alice = WC(test_file)
WC.counts(alice)
print("\n")

# Readability Index
print("readability.py")
print(readability.colman_liau(test_file))
print("\n")

# Change Spacing
print("spacing.py")
sp = Spacing(test_file)
Spacing.spacing_check(sp)
print("Spaces replaced")
print("\n")

# Replace Words
print("replace.py")
Replace(test_file, "Alice", "Dora the Explorer")
print("Words replaced")
print("\n")

Deployment

None! This is not a production-ready package. Install on your local machine and test it out and break things.

Built With

Love and Alice in Wonderland.

Authors

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. No guarantees, batteries sold separately.

textedit's People

Contributors

fonsecapaulo avatar nicoguaro avatar rfzahid avatar seyeadekanye avatar veekaybee avatar

Watchers

 avatar  avatar

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.