diff --git a/README.md b/README.md
index 9be4215a..9741a37d 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@
-
+
@@ -44,26 +44,26 @@
From zero to hero
-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.
-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.
-Hablas español? क्या आप हिंदी बोलते हैं? 日本語が話せるのか?
+¿Hablas español? क्या आप हिंदी बोलते हैं? 日本語が話せるのか?
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.
@@ -92,7 +92,7 @@ pip install texthero
Getting started
-The best way to learn Texthero is through the Getting Started docs.
+The best way to learn Texthero is through the Getting Started docs.
In case you are an advanced python user, then `help(texthero)` should do the work.
@@ -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")
@@ -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")
```
@@ -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
```
@@ -189,7 +192,7 @@ Remove diacritics.
```python
>>> s = hero.remove_diacritics(s)
->>> s
+>>> s
0 This sentence needs to be cleaned!
dtype: object
```
@@ -198,7 +201,7 @@ Remove punctuation.
```python
>>> s = hero.remove_punctuation(s)
->>> s
+>>> s
0 This sentence needs to be cleaned
dtype: object
```
@@ -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
```
@@ -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
```
@@ -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`)
@@ -268,6 +283,18 @@ Supported functions:
Full documentation: [visualization](https://texthero.org/docs/api-visualization)
+Pandas Typing
+
+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.
+
FAQ
Why Texthero
@@ -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.
@@ -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)