Giter Club home page Giter Club logo

3n-tools's Introduction

3n-tools

A set of simple novel authoring and analysis tools


##Installation - Python dependencies

###matplotlib

apt-get install python-matplotlib

###scipy

apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

###hunspell

~$	apt-get update
~$	apt-get install python2.7-dev
~$	apt-get install libhunspell-dev
~$	pip install hunspell

###treetagger3

http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/

###nltk (needed for treetagger3)

~$	pip install -U nltk
~$	pip install treetaggerwrapper

###treetagger-python

https://github.com/miotto/treetagger-python

Update os.environ["TREETAGGER_HOME"] in characterStats.py

The ./cache folder needs to be writeable.

###roman

~$	pip install roman

https://pypi.python.org/pypi/roman

##About File Formats

For historical reasons, characterStats.py needs books to be plain text, formatted as one chapter per line (all the text of the chapter is on the same line, preceded by the chapter number). To format a book as "1 chapter per line", a handy conversion script is provided:

python autoformat.py --file="books/madamebovary.txt" --out="books/"

=> will output the necessary madamebovary-compact.txt file

##Examples

###Graphical Representations

The most direct use of characterStats is to output graphical visualizations of the story:

python characterStats.py --file="books/madamebovary-compact.txt" -g

For some books, better results can be achieved by also looking up wikipedia pages for disambiguation:

python characterStats.py --file="books/madamebovary-compact.txt" -g --mwclient="fr.wikipedia.org"

###Setting the minimal number of occurences

By default, most significant entities are selected according to an heuristic. You can specify a fixed threshold with the -c parameter. The following example will visualize only entities quoted more than 20 times:

python characterStats.py --file="books/madamebovary-compact.txt" -c20 -g

###Extracting Named Entities

Verbose mode will output the classification results to console, where each row contains the name of the entity, assigned classification, confidence grade and number of citations:

python characterStats.py --file="books/madamebovary-compact.txt" -v

Emma	character	0.769230769231	354
Charles	character	0.840909090909	297
Rouen	place	0.625	59
[…]

Alternatively, summarized classification results (without confidence marks) can be output in JSON format:

python characterStats.py --file="books/madamebovary-compact.txt" -a

{
	"classes": {
		"place": ["Paris", "Rouen", "Tostes" […] "Croix"],
		"character": ["Lempereur" […] "Charles", "Emma"]
	},
	"substitutions": {"BalzacGeorge": "Balzac George", […]}
}

###Debug Mode

Debug mode will explain in details the classification process and output possible warnings:

python characterStats.py --file="books/madamebovary-compact.txt" -d

###Benchmark Example

The included madamebovary-compact.corr file shows a simple benchmark set that can be used to evaluate the quality of the classification.

python characterStats.py --file="books/madamebovary-compact.txt" -b

3n-tools's People

Contributors

cyrilbornet avatar

Stargazers

 avatar  avatar  avatar

Watchers

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