# roshanson/textinfoexp architecture

> Architecture diagram of the GitHub repository roshanson/textinfoexp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/roshanson/textinfoexp
- Repository: https://github.com/roshanson/textinfoexp

## Overview

This repository is a collection of standalone Chinese text-processing and machine-learning experiments rather than one integrated product. Its principal visible workflow is preparing text features and fitting a classifier; separate parts cover TF-IDF, CNN classification, clustering, word similarity, sentiment, relation extraction, and a translation utility. The sampled classifier and CNN sources show some calls; most other components are represented by their named source files, without inferred links between experiments.

Main entry points: [`Part6_Relation_Extraction/libsvm-3.21/svm.h`](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/svm.h) (LIBSVM API), [`Part1_TF-IDF/src/get_TF_IDF.py`](https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/get_TF_IDF.py) (TF-IDF Ranking), [`Part2_Text_Classify/cnn-text-classification-tf-chinese/train.py`](https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/cnn-text-classification-tf-chinese/train.py) (CNN Training), [`Part1_TF-IDF/src/GrobalParament.py`](https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/GrobalParament.py) (Processing Settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tfidf["TF-IDF"]
  node_tfidf_data["XML Text Extraction<br/>[get_data.py]"]
  node_tfidf_prep["Text Preprocessing<br/>[utils.py]"]
  node_tfidf_config["Processing Settings<br/>[GrobalParament.py]"]
  node_tfidf_compute["TF-IDF Ranking<br/>[get_TF_IDF.py]"]
end

subgraph group_classify["Text Classification"]
  node_class_features["Text Features<br/>[feature.py]"]
  node_class_models["Classical Classifiers<br/>[classifier.py]"]
  node_class_helper["CNN Data Helpers<br/>[data_helpers.py]"]
  node_class_cnn["Text CNN<br/>[text_cnn.py]"]
  node_class_train["CNN Training<br/>[train.py]"]
  node_class_other["Classifier Utilities<br/>[get_cls.py]"]
end

subgraph group_cluster["Text Clustering"]
  node_cluster_model["Text Clustering<br/>[TextCluster.py]"]
  node_cluster_results["Cluster Results<br/>[get_res.py]"]
end

subgraph group_similarity["Word Similarity"]
  node_similarity_cilin["Cilin Similarity<br/>[cilin.cpp]"]
  node_similarity_binding["Cilin Python Binding<br/>[cilin_call.py]"]
  node_similarity_vectors["Word2Vec Similarity<br/>[gensim_wors2vec.py]"]
end

subgraph group_sentiment["Sentiment Analysis"]
  node_sentiment_corpus["Sentiment Corpus<br/>[corpus.py]"]
  node_sentiment_features["Sentiment Features"]
  node_sentiment_models["Sentiment Classifiers<br/>[classifiers.py]"]
  node_sentiment_tools["Sentiment Tools<br/>[tools.py]"]
end

subgraph group_relation["Relation Extraction"]
  node_relation_features["Relation Features<br/>[feature_extract.py]"]
  node_svm_core["LIBSVM Core<br/>[svm.cpp]"]
  node_svm_api["LIBSVM API<br/>[svm.h]"]
  node_svm_train["SVM Training CLI<br/>[svm-train.c]"]
  node_svm_matlab["MATLAB Bindings<br/>[svmtrain.c]"]
  node_svm_predict_matlab["MATLAB Prediction<br/>[svmpredict.c]"]
  node_svm_python["Python SVM API<br/>[svm.py]"]
  node_svm_java["Java SVM API<br/>[svm.java]"]
  node_svm_scale["Java Data Scaling<br/>[svm_scale.java]"]
  node_svm_toy["Java SVM Demo<br/>[svm_toy.java]"]
end

node_translate["Google Translation Utility"]

node_tfidf_data -->|"reads settings"| node_tfidf_config
node_tfidf_compute -->|"preprocesses text"| node_tfidf_prep
node_tfidf_compute -->|"reads settings"| node_tfidf_config
node_class_models -->|"loads data"| node_class_features
node_class_train -->|"loads and batches"| node_class_helper
node_class_train -->|"trains model"| node_class_cnn
node_svm_train -->|"uses API"| node_svm_api
node_svm_matlab -->|"calls API"| node_svm_api
node_svm_predict_matlab -->|"calls API"| node_svm_api
node_svm_core -->|"implements API"| node_svm_api

click node_tfidf_data "https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/get_data.py"
click node_tfidf_prep "https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/utils.py"
click node_tfidf_config "https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/GrobalParament.py"
click node_tfidf_compute "https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/get_TF_IDF.py"
click node_class_features "https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/feature.py"
click node_class_models "https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/classifier.py"
click node_class_helper "https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/cnn-text-classification-tf-chinese/data_helpers.py"
click node_class_cnn "https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/cnn-text-classification-tf-chinese/text_cnn.py"
click node_class_train "https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/cnn-text-classification-tf-chinese/train.py"
click node_class_other "https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/src/get_cls.py"
click node_cluster_model "https://github.com/roshanson/textinfoexp/blob/master/Part3_Text_Cluster/src/TextCluster.py"
click node_cluster_results "https://github.com/roshanson/textinfoexp/blob/master/Part3_Text_Cluster/src/get_res.py"
click node_similarity_cilin "https://github.com/roshanson/textinfoexp/blob/master/Part4_Word_Similarity/get_similarity/cilin.cpp"
click node_similarity_binding "https://github.com/roshanson/textinfoexp/blob/master/Part4_Word_Similarity/get_similarity/cilin_call.py"
click node_similarity_vectors "https://github.com/roshanson/textinfoexp/blob/master/Part4_Word_Similarity/word2vec/gensim_wors2vec.py"
click node_sentiment_corpus "https://github.com/roshanson/textinfoexp/blob/master/Part5_Sentiment_Analysis/src/corpus.py"
click node_sentiment_features "https://github.com/roshanson/textinfoexp/blob/master/Part5_Sentiment_Analysis/src/feature_extraction.py"
click node_sentiment_models "https://github.com/roshanson/textinfoexp/blob/master/Part5_Sentiment_Analysis/src/classifiers.py"
click node_sentiment_tools "https://github.com/roshanson/textinfoexp/blob/master/Part5_Sentiment_Analysis/src/tools.py"
click node_relation_features "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/feature_extract.py"
click node_svm_core "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/svm.cpp"
click node_svm_api "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/svm.h"
click node_svm_train "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/svm-train.c"
click node_svm_matlab "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/matlab/svmtrain.c"
click node_svm_predict_matlab "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/matlab/svmpredict.c"
click node_svm_python "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/python/svm.py"
click node_svm_java "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/java/libsvm/svm.java"
click node_svm_scale "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/java/svm_scale.java"
click node_svm_toy "https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/java/svm_toy.java"
click node_translate "https://github.com/roshanson/textinfoexp/blob/master/Tools/mul_thd_google_translate.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_tfidf_data,node_tfidf_prep,node_tfidf_config,node_tfidf_compute toneBlue
class node_class_features,node_class_models,node_class_helper,node_class_cnn,node_class_train,node_class_other toneAmber
class node_cluster_model,node_cluster_results toneMint
class node_similarity_cilin,node_similarity_binding,node_similarity_vectors toneRose
class node_sentiment_corpus,node_sentiment_features,node_sentiment_models,node_sentiment_tools toneIndigo
class node_relation_features,node_svm_core,node_svm_api,node_svm_train,node_svm_matlab,node_svm_predict_matlab,node_svm_python,node_svm_java,node_svm_scale,node_svm_toy,node_translate toneTeal
```

## Components

### TF-IDF

- [XML Text Extraction](https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/get_data.py): `Part1_TF-IDF/src/get_data.py`
- [Text Preprocessing](https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/utils.py): `Part1_TF-IDF/src/utils.py`
- [Processing Settings](https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/GrobalParament.py): `Part1_TF-IDF/src/GrobalParament.py`
- [TF-IDF Ranking](https://github.com/roshanson/textinfoexp/blob/master/Part1_TF-IDF/src/get_TF_IDF.py): `Part1_TF-IDF/src/get_TF_IDF.py`

### Text Classification

- [Text Features](https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/feature.py): `Part2_Text_Classify/feature.py`
- [Classical Classifiers](https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/classifier.py): `Part2_Text_Classify/classifier.py`
- [CNN Data Helpers](https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/cnn-text-classification-tf-chinese/data_helpers.py): `Part2_Text_Classify/cnn-text-classification-tf-chinese/data_helpers.py`
- [Text CNN](https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/cnn-text-classification-tf-chinese/text_cnn.py): `Part2_Text_Classify/cnn-text-classification-tf-chinese/text_cnn.py`
- [CNN Training](https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/cnn-text-classification-tf-chinese/train.py): `Part2_Text_Classify/cnn-text-classification-tf-chinese/train.py`
- [Classifier Utilities](https://github.com/roshanson/textinfoexp/blob/master/Part2_Text_Classify/src/get_cls.py): `Part2_Text_Classify/src/get_cls.py`

### Text Clustering

- [Text Clustering](https://github.com/roshanson/textinfoexp/blob/master/Part3_Text_Cluster/src/TextCluster.py): `Part3_Text_Cluster/src/TextCluster.py`
- [Cluster Results](https://github.com/roshanson/textinfoexp/blob/master/Part3_Text_Cluster/src/get_res.py): `Part3_Text_Cluster/src/get_res.py`

### Word Similarity

- [Cilin Similarity](https://github.com/roshanson/textinfoexp/blob/master/Part4_Word_Similarity/get_similarity/cilin.cpp): `Part4_Word_Similarity/get_similarity/cilin.cpp`
- [Cilin Python Binding](https://github.com/roshanson/textinfoexp/blob/master/Part4_Word_Similarity/get_similarity/cilin_call.py): `Part4_Word_Similarity/get_similarity/cilin_call.py`
- [Word2Vec Similarity](https://github.com/roshanson/textinfoexp/blob/master/Part4_Word_Similarity/word2vec/gensim_wors2vec.py): `Part4_Word_Similarity/word2vec/gensim_wors2vec.py`

### Sentiment Analysis

- [Sentiment Corpus](https://github.com/roshanson/textinfoexp/blob/master/Part5_Sentiment_Analysis/src/corpus.py): `Part5_Sentiment_Analysis/src/corpus.py`
- [Sentiment Features](https://github.com/roshanson/textinfoexp/blob/master/Part5_Sentiment_Analysis/src/feature_extraction.py): `Part5_Sentiment_Analysis/src/feature_extraction.py`
- [Sentiment Classifiers](https://github.com/roshanson/textinfoexp/blob/master/Part5_Sentiment_Analysis/src/classifiers.py): `Part5_Sentiment_Analysis/src/classifiers.py`
- [Sentiment Tools](https://github.com/roshanson/textinfoexp/blob/master/Part5_Sentiment_Analysis/src/tools.py): `Part5_Sentiment_Analysis/src/tools.py`

### Relation Extraction

- [Relation Features](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/feature_extract.py): `Part6_Relation_Extraction/feature_extract.py`
- [LIBSVM Core](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/svm.cpp): `Part6_Relation_Extraction/libsvm-3.21/svm.cpp`
- [LIBSVM API](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/svm.h): `Part6_Relation_Extraction/libsvm-3.21/svm.h`
- [SVM Training CLI](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/svm-train.c): `Part6_Relation_Extraction/libsvm-3.21/svm-train.c`
- [MATLAB Bindings](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/matlab/svmtrain.c): `Part6_Relation_Extraction/libsvm-3.21/matlab/svmtrain.c`
- [MATLAB Prediction](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/matlab/svmpredict.c): `Part6_Relation_Extraction/libsvm-3.21/matlab/svmpredict.c`
- [Python SVM API](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/python/svm.py): `Part6_Relation_Extraction/libsvm-3.21/python/svm.py`
- [Java SVM API](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/java/libsvm/svm.java): `Part6_Relation_Extraction/libsvm-3.21/java/libsvm/svm.java`
- [Java Data Scaling](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/java/svm_scale.java): `Part6_Relation_Extraction/libsvm-3.21/java/svm_scale.java`
- [Java SVM Demo](https://github.com/roshanson/textinfoexp/blob/master/Part6_Relation_Extraction/libsvm-3.21/java/svm_toy.java): `Part6_Relation_Extraction/libsvm-3.21/java/svm_toy.java`

### Other components

- [Google Translation Utility](https://github.com/roshanson/textinfoexp/blob/master/Tools/mul_thd_google_translate.py): `Tools/mul_thd_google_translate.py`

## Connections

- XML Text Extraction → Processing Settings: reads settings (evidence: `Part1_TF-IDF/src/get_data.py`)
- TF-IDF Ranking → Text Preprocessing: preprocesses text (evidence: `Part1_TF-IDF/src/get_TF_IDF.py`)
- TF-IDF Ranking → Processing Settings: reads settings (evidence: `Part1_TF-IDF/src/get_TF_IDF.py`)
- Classical Classifiers → Text Features: loads data (evidence: `Part2_Text_Classify/classifier.py`)
- CNN Training → CNN Data Helpers: loads and batches (evidence: `Part2_Text_Classify/cnn-text-classification-tf-chinese/train.py`)
- CNN Training → Text CNN: trains model (evidence: `Part2_Text_Classify/cnn-text-classification-tf-chinese/train.py`)
- SVM Training CLI → LIBSVM API: uses API (evidence: `Part6_Relation_Extraction/libsvm-3.21/svm-train.c`)
- MATLAB Bindings → LIBSVM API: calls API (evidence: `Part6_Relation_Extraction/libsvm-3.21/matlab/svmtrain.c`)
- MATLAB Prediction → LIBSVM API: calls API (evidence: `Part6_Relation_Extraction/libsvm-3.21/matlab/svmpredict.c`)
- LIBSVM Core → LIBSVM API: implements API (evidence: `Part6_Relation_Extraction/libsvm-3.21/svm.cpp`)
