Skip to content

Commit dfa511e

Browse files
committed
Added docs
1 parent 88e41a4 commit dfa511e

13 files changed

+1091
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
129129

130130
- **GitHub Repository**: [Github](https://github.com/ankit-aglawe/textpredict)
131131
- **PyPI Project**: [PYPI](https://pypi.org/project/textpredict/)
132-
- **Documentation**: [Readthedocs](https://github.com/ankit-aglawe/sentimentpredictor#readme)
132+
- **Documentation**: [TextPredict Documentation](https://ankit-aglawe.github.io/textpredict/)
133133
- **Source Code**: [Source Code](https://github.com/ankit-aglawe/sentimentpredictor)
134134
- **Issue Tracker**: [Issue Tracker](https://github.com/ankit-aglawe/sentimentpredictor/issues)
135135

docs/api_reference.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# API Reference
2+
3+
## `textpredict.initialize`
4+
5+
Initialize the TextPredict model for a specific task.
6+
7+
### Parameters
8+
9+
- `task` (str): The task to perform (e.g., 'sentiment', 'emotion', 'zeroshot', 'ner', 'sequence_classification', 'token_classification', 'seq2seq').
10+
- `device` (str, optional): The device to run the model on. Defaults to 'cpu'.
11+
- `model_name` (str, optional): The model name. Defaults to None.
12+
- `source` (str, optional): The source of the model ('huggingface' or 'local'). Defaults to 'huggingface'.
13+
14+
### Returns
15+
16+
An initialized TextPredict model.
17+
18+
## `textpredict.model.analyze`
19+
20+
Analyze the provided texts using the initialized model.
21+
22+
### Parameters
23+
24+
- `texts` (list of str): The texts to analyze.
25+
- `return_probs` (bool, optional): Whether to return probabilities along with predictions. Defaults to False.
26+
27+
### Returns
28+
29+
Analysis results for the provided texts.
30+
31+
## `textpredict.SequenceClassificationTrainer`
32+
33+
Trainer class for sequence classification models.
34+
35+
### Parameters
36+
37+
- `model_name` (str): The name of the model to use.
38+
- `output_dir` (str): The directory to save the trained model.
39+
- `train_dataset` (Dataset): The dataset to use for training.
40+
- `val_dataset` (Dataset): The dataset to use for validation.
41+
42+
### Methods
43+
44+
- `train(from_checkpoint=True)`: Train the model.
45+
- `save()`: Save the trained model.
46+
- `evaluate(test_dataset)`: Evaluate the model on the test dataset.
47+
48+
## `textpredict.Explainability`
49+
50+
Class for model explainability and feature importance.
51+
52+
### Parameters
53+
54+
- `model_name` (str): The name of the model to use.
55+
- `task` (str): The task to perform.
56+
- `device` (str, optional): The device to run the model on. Defaults to 'cpu'.
57+
58+
### Methods
59+
60+
- `feature_importance(text)`: Get feature importance for the given text.

docs/assets/logo.png

342 KB
Loading

docs/assets/logo3.png

190 KB
Loading

docs/css/custom.css

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
/* Custom CSS */
2+
body {
3+
font-family: 'Roboto', sans-serif;
4+
}
5+
6+
/* Additional custom styles */
7+
.termynal-comment {
8+
color: #4a968f;
9+
font-style: italic;
10+
display: block;
11+
}
12+
13+
.termy {
14+
/* For right to left languages */
15+
direction: ltr;
16+
}
17+
18+
.termy [data-termynal] {
19+
white-space: pre-wrap;
20+
}
21+
22+
a.external-link {
23+
/* For right to left languages */
24+
direction: ltr;
25+
display: inline-block;
26+
}
27+
28+
a.external-link::after {
29+
/* \00A0 is a non-breaking space
30+
to make the mark be on the same line as the link
31+
*/
32+
content: "\00A0[↪]";
33+
}
34+
35+
a.internal-link::after {
36+
/* \00A0 is a non-breaking space
37+
to make the mark be on the same line as the link
38+
*/
39+
content: "\00A0↪";
40+
}
41+
42+
.shadow {
43+
box-shadow: 5px 5px 10px #999;
44+
}
45+
46+
/* Give space to lower icons so Gitter chat doesn't get on top of them */
47+
.md-footer-meta {
48+
padding-bottom: 2em;
49+
}
50+
51+
.user-list {
52+
display: flex;
53+
flex-wrap: wrap;
54+
margin-bottom: 2rem;
55+
}
56+
57+
.user-list-center {
58+
justify-content: space-evenly;
59+
}
60+
61+
.user {
62+
margin: 1em;
63+
min-width: 7em;
64+
}
65+
66+
.user .avatar-wrapper {
67+
width: 80px;
68+
height: 80px;
69+
margin: 10px auto;
70+
overflow: hidden;
71+
border-radius: 50%;
72+
position: relative;
73+
}
74+
75+
.user .avatar-wrapper img {
76+
position: absolute;
77+
top: 50%;
78+
left: 50%;
79+
transform: translate(-50%, -50%);
80+
}
81+
82+
.user .title {
83+
text-align: center;
84+
}
85+
86+
.user .count {
87+
font-size: 80%;
88+
text-align: center;
89+
}
90+
91+
a.announce-link:link,
92+
a.announce-link:visited {
93+
color: #fff;
94+
}
95+
96+
a.announce-link:hover {
97+
color: var(--md-accent-fg-color);
98+
}
99+
100+
.announce-wrapper {
101+
display: flex;
102+
justify-content: space-between;
103+
flex-wrap: wrap;
104+
align-items: center;
105+
}
106+
107+
.announce-wrapper div.item {
108+
display: none;
109+
}
110+
111+
.announce-wrapper .sponsor-badge {
112+
display: block;
113+
position: absolute;
114+
top: -10px;
115+
right: 0;
116+
font-size: 0.5rem;
117+
color: #999;
118+
background-color: #666;
119+
border-radius: 10px;
120+
padding: 0 10px;
121+
z-index: 10;
122+
}
123+
124+
.announce-wrapper .sponsor-image {
125+
display: block;
126+
border-radius: 20px;
127+
}
128+
129+
.announce-wrapper>div {
130+
min-height: 40px;
131+
display: flex;
132+
align-items: center;
133+
}
134+
135+
.twitter {
136+
color: #00acee;
137+
}
138+
139+
/* Right to left languages */
140+
code {
141+
direction: ltr;
142+
display: inline-block;
143+
}
144+
145+
.illustration {
146+
margin-top: 2em;
147+
margin-bottom: 2em;
148+
}
149+
150+
/* Screenshots */
151+
/*
152+
Simulate a browser window frame.
153+
Inspired by Termynal's CSS tricks with modifications
154+
*/
155+
156+
.screenshot {
157+
display: block;
158+
background-color: #d3e0de;
159+
border-radius: 4px;
160+
padding: 45px 5px 5px;
161+
position: relative;
162+
-webkit-box-sizing: border-box;
163+
box-sizing: border-box;
164+
}
165+
166+
.screenshot img {
167+
display: block;
168+
border-radius: 2px;
169+
}
170+
171+
.screenshot:before {
172+
content: '';
173+
position: absolute;
174+
top: 15px;
175+
left: 15px;
176+
display: inline-block;
177+
width: 15px;
178+
height: 15px;
179+
border-radius: 50%;
180+
/* A little hack to display the window buttons in one pseudo element. */
181+
background: #d9515d;
182+
-webkit-box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
183+
box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
184+
}

docs/css/termynal.css

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/**
2+
* termynal.js
3+
*
4+
* @author Ines Montani <ines@ines.io>
5+
* @version 0.0.1
6+
* @license MIT
7+
*/
8+
9+
:root {
10+
--color-bg: #252a33;
11+
--color-text: #eee;
12+
--color-text-subtle: #a2a2a2;
13+
}
14+
15+
[data-termynal] {
16+
width: 750px;
17+
max-width: 100%;
18+
background: var(--color-bg);
19+
color: var(--color-text);
20+
/* font-size: 18px; */
21+
font-size: 15px;
22+
/* font-family: 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace; */
23+
font-family: 'Roboto Mono', 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace;
24+
border-radius: 4px;
25+
padding: 75px 45px 35px;
26+
position: relative;
27+
-webkit-box-sizing: border-box;
28+
box-sizing: border-box;
29+
line-height: 1.2;
30+
}
31+
32+
[data-termynal]:before {
33+
content: '';
34+
position: absolute;
35+
top: 15px;
36+
left: 15px;
37+
display: inline-block;
38+
width: 15px;
39+
height: 15px;
40+
border-radius: 50%;
41+
/* A little hack to display the window buttons in one pseudo element. */
42+
background: #d9515d;
43+
-webkit-box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
44+
box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
45+
}
46+
47+
[data-termynal]:after {
48+
content: 'bash';
49+
position: absolute;
50+
color: var(--color-text-subtle);
51+
top: 5px;
52+
left: 0;
53+
width: 100%;
54+
text-align: center;
55+
}
56+
57+
a[data-terminal-control] {
58+
text-align: right;
59+
display: block;
60+
color: #aebbff;
61+
}
62+
63+
[data-ty] {
64+
display: block;
65+
line-height: 2;
66+
}
67+
68+
[data-ty]:before {
69+
/* Set up defaults and ensure empty lines are displayed. */
70+
content: '';
71+
display: inline-block;
72+
vertical-align: middle;
73+
}
74+
75+
[data-ty="input"]:before,
76+
[data-ty-prompt]:before {
77+
margin-right: 0.75em;
78+
color: var(--color-text-subtle);
79+
}
80+
81+
[data-ty="input"]:before {
82+
content: '$';
83+
}
84+
85+
[data-ty][data-ty-prompt]:before {
86+
content: attr(data-ty-prompt);
87+
}
88+
89+
[data-ty-cursor]:after {
90+
content: attr(data-ty-cursor);
91+
font-family: monospace;
92+
margin-left: 0.5em;
93+
-webkit-animation: blink 1s infinite;
94+
animation: blink 1s infinite;
95+
}
96+
97+
98+
/* Cursor animation */
99+
100+
@-webkit-keyframes blink {
101+
50% {
102+
opacity: 0;
103+
}
104+
}
105+
106+
@keyframes blink {
107+
50% {
108+
opacity: 0;
109+
}
110+
}

0 commit comments

Comments
 (0)