File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -155,13 +155,17 @@ MMI.metadata_pkg(TfidfTransformer,
155
155
is_wrapper= false
156
156
)
157
157
158
+ const ScientificNGram{N} = NTuple{<: Any ,STB. Textual}
159
+
158
160
MMI. metadata_model (TfidfTransformer,
159
161
input_scitype = Union{
160
- AbstractVector{<: AbstractVector{STB.Textual} }, AbstractVector{<: STB.Multiset{<:NGram} }, AbstractVector{<: STB.Multiset{STB.Textual} }
162
+ AbstractVector{<: AbstractVector{STB.Textual} },
163
+ AbstractVector{<: STB.Multiset{<:ScientificNGram} },
164
+ AbstractVector{<: STB.Multiset{STB.Textual} }
161
165
},
162
- output_scitype = AbstractMatrix{STB. Continuous},# ie, a classifier
163
- docstring = " Build TF-IDF matrix from raw documents" , # brief description
166
+ output_scitype = AbstractMatrix{STB. Continuous},
167
+ docstring = " Build TF-IDF matrix from raw documents" ,
164
168
path = " MLJText.TfidfTransformer"
165
169
)
166
170
167
- end # module
171
+ end # module
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ using TextAnalysis
12
12
13
13
# train transformer
14
14
tfidf_transformer = MLJText. TfidfTransformer ()
15
- test_machine = machine (tfidf_transformer, ngram_vec)
15
+ test_machine = @test_logs machine (tfidf_transformer, ngram_vec)
16
16
MLJBase. fit! (test_machine)
17
17
18
18
# test
@@ -39,7 +39,6 @@ using TextAnalysis
39
39
@test sum (test4, dims= 2 )[1 ] == 0.0
40
40
@test sum (test4, dims= 2 )[2 ] > 0.0
41
41
@test size (test4) == (2 , 11 )
42
-
43
42
# test with bag of words
44
43
bag_of_words = Dict (
45
44
" cat in" => 1 ,
@@ -53,7 +52,7 @@ using TextAnalysis
53
52
)
54
53
bag = Dict {MLJText.NGram, Int} (Tuple (String .(split (k))) => v for (k, v) in bag_of_words)
55
54
tfidf_transformer2 = MLJText. TfidfTransformer ()
56
- test_machine2 = machine (tfidf_transformer2, [bag])
55
+ test_machine2 = @test_logs machine (tfidf_transformer2, [bag])
57
56
MLJBase. fit! (test_machine2)
58
57
59
58
test_doc5 = [" How about a cat in a hat" ]
You can’t perform that action at this time.
0 commit comments