You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/nlp/lda/README.md
+23-34Lines changed: 23 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,26 +33,23 @@ limitations under the License.
33
33
## Usage
34
34
35
35
```javascript
36
-
var lda =require( '@stdlib/nlp/lda' );
36
+
constlda=require( '@stdlib/nlp/lda' );
37
37
```
38
38
39
39
#### lda( docs, K\[, options] )
40
40
41
41
[Latent Dirichlet Allocation][lda] via collapsed Gibbs sampling. To create a model, call the `lda` function by passing it an `array` of `strings` and the number of topics `K` that should be identified.
42
42
43
43
```javascript
44
-
var model;
45
-
var docs;
46
-
47
-
docs = [
44
+
constdocs= [
48
45
'I loved you first',
49
46
'For one is both and both are one in love',
50
47
'You never see my pain',
51
48
'My love is such that rivers cannot quench',
52
49
'See a lot of pain, a lot of tears'
53
50
];
54
51
55
-
model =lda( docs, 2 );
52
+
constmodel=lda( docs, 2 );
56
53
// returns {}
57
54
```
58
55
@@ -77,7 +74,7 @@ Returns the `no` terms with the highest probabilities for chosen topic `k`.
77
74
<!-- run-disable -->
78
75
79
76
```javascript
80
-
var words =model.getTerms( 0, 3 );
77
+
constwords=model.getTerms( 0, 3 );
81
78
/* returns
82
79
[
83
80
{ 'word': 'both', 'prob': 0.06315008476532499 },
@@ -98,62 +95,54 @@ var words = model.getTerms( 0, 3 );
98
95
<!-- eslint no-undef: "error" -->
99
96
100
97
```javascript
101
-
var sotu =require( '@stdlib/datasets/sotu' );
102
-
var roundn =require( '@stdlib/math/base/special/roundn' );
103
-
var stopwords =require( '@stdlib/datasets/stopwords-en' );
104
-
var lowercase =require( '@stdlib/string/lowercase' );
0 commit comments