Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #117

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 53 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<a href="https://github.com/jbesomi/texthero/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/jbesomi/texthero.svg"
alt="Github license">
</a>
</a>
</p>

<p align="center">
Expand All @@ -44,26 +44,26 @@

<h2 align="center">From zero to hero</h2>

Texthero is a python toolkit to work with text-based dataset quickly and effortlessly. Texthero is very simple to learn and designed to be used on top of Pandas. Texthero has the same expressiveness and power of Pandas and is extensively documented. Texthero is modern and conceived for programmers of the 2020 decade with little knowledge if any in linguistic.
Texthero is a python toolkit to work with text-based dataset quickly and effortlessly. Texthero is very simple to learn and designed to be used on top of Pandas. Texthero has the same expressiveness and power of Pandas and is extensively documented. Texthero is modern and conceived for programmers of the 2020 decade with little knowledge if any in linguistic.

You can think of Texthero as a tool to help you _understand_ and work with text-based dataset. Given a tabular dataset, it's easy to _grasp the main concept_. Instead, given a text dataset, it's harder to have quick insights into the underline data. With Texthero, preprocessing text data, mapping it into vectors, and visualizing the obtained vector space takes just a couple of lines.

mk2510 marked this conversation as resolved.
Show resolved Hide resolved
Texthero include tools for:
* Preprocess text data: it offers both out-of-the-box solutions but it's also flexible for custom-solutions.
Texthero includes tools for:

* Preprocessing text data: clean and tokenize texts with support for both out-of-the-box and custom solutions.
* Natural Language Processing: keyphrases and keywords extraction, and named entity recognition.
* Text representation: TF-IDF, term frequency, and custom word-embeddings (wip)
* Vector space analysis: clustering (K-means, Meanshift, DBSCAN and Hierarchical), topic modeling (wip) and interpretation.
* Text visualization: vector space visualization, place localization on maps (wip).
* Text Representation: vectorization with TF-IDF / Term Frequency / Count, and custom word embeddings (wip)
* Vector space analysis: dimensionality reduction (PCA, NMF, t-SNE) and clustering

Texthero is free, open-source and [well documented](https://texthero.org/docs) (and that's what we love most by the way!).
Texthero is free, open-source and [well documented](https://texthero.org/docs) (and that's what we love most by the way!).

We hope you will find pleasure working with Texthero as we had during his development.

<h2 align="center">Hablas español? क्या आप हिंदी बोलते हैं? 日本語が話せるのか?</h2>
<h2 align="center">¿Hablas español? क्या आप हिंदी बोलते हैं? 日本語が話せるのか?</h2>

Texthero has been developed for the whole NLP community. We know how hard it is to deal with different NLP tools (NLTK, SpaCy, Gensim, TextBlob, Sklearn): that's why we developed Texthero, to simplify things.

Now, the next main milestone is to provide *multilingual support* and for this big step, we need the help of all of you. ¿Hablas español? Sie sprechen Deutsch? 你会说中文 日本語が話せるのか? Fala português? Parli Italiano? Вы говорите по-русски? If yes or you speak another language not mentioned here, then you might help us develop multilingual support! Even if you haven't contributed before or you just started with NLP, contact us or open a Github issue, there is always a first time :) We promise you will learn a lot, and, ... who knows? It might help you find your new job as an NLP-developer!
Now, the next main milestone is to provide *multilingual support* and for this big step, we need the help of all of you. ¿Hablas español? Sprechen Sie Deutsch? 你会说中文 日本語が話せるのか?Fala português? Parli Italiano? Вы говорите по-русски? If yes or you speak another language not mentioned here, then you might help us develop multilingual support! Even if you haven't contributed before or you just started with NLP, contact us or open a Github issue, there is always a first time :) We promise you will learn a lot, and, ... who knows? It might help you find your new job as an NLP-developer!

For improving the python toolkit and provide an even better experience, your aid and feedback are crucial. If you have any problem or suggestion please open a Github [issue](https://github.com/jbesomi/texthero/issues), we will be glad to support you and help you.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the "Beta version" part still make sense (@jbesomi )?

Expand Down Expand Up @@ -92,7 +92,7 @@ pip install texthero

<h2 align="center">Getting started</h2>

The best way to learn Texthero is through the <a href="https://texthero.org/docs/getting-started">Getting Started</a> docs.
The best way to learn Texthero is through the <a href="https://texthero.org/docs/getting-started">Getting Started</a> docs.

In case you are an advanced python user, then `help(texthero)` should do the work.

Expand All @@ -106,13 +106,15 @@ import texthero as hero
import pandas as pd

df = pd.read_csv(
"https://github.com/jbesomi/texthero/raw/master/dataset/bbcsport.csv"
"https://github.com/jbesomi/texthero/raw/master/dataset/bbcsport.csv"
)

df['pca'] = (
df['text']
.pipe(hero.clean)
.pipe(hero.tokenize)
.pipe(hero.tfidf)
.pipe(hero.normalize)
.pipe(hero.pca)
)
hero.scatterplot(df, 'pca', color='topic', title="PCA BBC Sport news")
Expand All @@ -132,19 +134,20 @@ df = pd.read_csv(
"https://github.com/jbesomi/texthero/raw/master/dataset/bbcsport.csv"
)

df['tfidf'] = (
df['tokenized'] = (
df['text']
.pipe(hero.clean)
.pipe(hero.tfidf)
.pipe(hero.tokenize)
)

df['kmeans_labels'] = (
df['tfidf']
df['tokenized']
.pipe(hero.tfidf)
.pipe(hero.normalize)
.pipe(hero.kmeans, n_clusters=5)
.astype(str)
)

df['pca'] = df['tfidf'].pipe(hero.pca)
df['pca'] = df['tokenized'].pipe(hero.tfidf).pipe(hero.normalize)pipe(hero.pca)

hero.scatterplot(df, 'pca', color='kmeans_labels', title="K-means BBC Sport news")
```
Expand Down Expand Up @@ -180,7 +183,7 @@ Remove all types of brackets and their content.

```python
>>> s = hero.remove_brackets(s)
>>> s
>>> s
0 This sèntencé needs to be cleaned!
dtype: object
```
Expand All @@ -189,7 +192,7 @@ Remove diacritics.

```python
>>> s = hero.remove_diacritics(s)
>>> s
>>> s
0 This sentence needs to be cleaned!
dtype: object
```
Expand All @@ -198,7 +201,7 @@ Remove punctuation.

```python
>>> s = hero.remove_punctuation(s)
>>> s
>>> s
0 This sentence needs to be cleaned
dtype: object
```
Expand All @@ -207,7 +210,7 @@ Remove extra white-spaces.

```python
>>> s = hero.remove_whitespace(s)
>>> s
>>> s
0 This sentence needs to be cleaned
dtype: object
```
Expand All @@ -217,7 +220,16 @@ Sometimes we also want to get rid of stop-words.
```python
>>> s = hero.remove_stopwords(s)
>>> s
0 This sentence needs cleaned
0 This sentence needs cleaned
dtype: object
```

There is also the option to clean the text automatically by calling the "clean"-function instead of doing it step by step.
```python
>>> text = "This sèntencé (123 /) needs to [OK!] be cleaned! "
>>> s = pd.Series(text)
>>> hero.clean(s)
0 sentence needs cleaned
dtype: object
```

Expand All @@ -243,9 +255,12 @@ Full documentation: [nlp](https://texthero.org/docs/api-nlp)
**Scope:** map text data into vectors and do dimensionality reduction.

Supported **representation** algorithms:
1. Term frequency (`count`)
1. counting terms (`count`)
1. Term frequency (`term_frequency`)
1. Term frequency-inverse document frequency (`tfidf`)

For the "representation" functions it is strongly recommended to tokenize the input series first with the `hero.tokenize(s)` function from the texthero library.

Supported **clustering** algorithms:
1. K-means (`kmeans`)
1. Density-Based Spatial Clustering of Applications with Noise (`dbscan`)
Expand All @@ -268,6 +283,18 @@ Supported functions:

Full documentation: [visualization](https://texthero.org/docs/api-visualization)

<h2 align="center">Pandas Typing</h2>

What is pandas typing? Each category of functions, which are defined above, accepts a different type of pandas series or a pandas dataframe. Those are explained here. These types will in general improve the efficiency of the different algorithms as they are especially designed for those.

You usually don't need to worry about them, because, if you use a typical texthero pipeline, the different types are seamlessly integrated across all modules". The typical hero pipeline will:
* first clean the text "with preprocessing functions, e.g. `clean`, and tokenize it with `tokenize`,
* then use `tfidf`, `term_frequency`, `count`, or other embeddings (wip) to vectorize the text,
* then do dimensionality reduction with `pca`, `tsne` or `nmf` to reduce noise and showcase the differences between the vectors
* and finally use clustering to find topics, and visualize the dataset.

If your pipeline differs, you might want to check out the tutorial on series types to understand which type of pandas objects you will get returned and which types will be accepted by the functions.

<h2 align="center">FAQ</h2>

<h5>Why Texthero</h5>
Expand Down Expand Up @@ -295,7 +322,7 @@ The website will be soon moved from Docusaurus to Sphinx: read the [open issue t

**Are you good at writing?**

Probably this is the most important piece missing now on Texthero: more tutorials and more "Getting Started" guide.
Probably this is the most important piece missing now on Texthero: more tutorials and more "Getting Started" guide.

If you are good at writing you can help us! Why don't you start by [Adding a FAQ page to the website](https://github.com/jbesomi/texthero/issues/41) or explain how to [create a custom pipeline](https://github.com/jbesomi/texthero/issues/38)? Need help? We are there for you.

Expand All @@ -314,6 +341,8 @@ If you have just other questions or inquiry drop me a line at jonathanbesomi__AT
- [bobfang1992](https://github.com/bobfang1992)
- [Ishan Arora](https://github.com/ishanarora04)
- [Vidya P](https://github.com/vidyap-xgboost)
- [Henri Froese](https://github.com/henrifroese)
- [Maximilian Krahn](https://github.com/mk2510)
- [Cedric Conol](https://github.com/cedricconol)
- [Rich Ramalho](https://github.com/richecr)

Expand Down