JuliaText / TextAnalysis.jl

Julia package for text analysis
Other
373 stars 95 forks source link

Converting Corpus to Dataframe not working. #279

Closed drizk1 closed 7 months ago

drizk1 commented 7 months ago

I saw issue #236 was fixed but i am encountering an error. is there a different way for me to do this?

crps = Corpus([StringDocument("hello world")])
update_lexicon!(crps)

convert(DataFrame, crps)

ERROR: MethodError: Cannot `convert` an object of type Corpus{StringDocument{String}} to an object of type DataFrame

Closest candidates are:
  convert(::Type{DataFrame}, ::SubDataFrame)
   @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/subdataframe/subdataframe.jl:319
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:64
  DataFrame(::Any; copycols)
   @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/other/tables.jl:48
  ...

Stacktrace:
 [1] top-level scope
   @ ~/Desktop/Julia Libraries/datesnstrings/scratch:371
rssdev10 commented 7 months ago

You don't need to do convert. Corpus implements the Tables interface. Use: DataFrame(crps) instead.

drizk1 commented 7 months ago

awesome. thank you.