useDynLib("tm", .registration = TRUE)

importFrom("NLP", "content", "content<-", "meta", "meta<-", "words",
           "as.Token_Tokenizer", "is.Span_Tokenizer", "Token_Tokenizer",
           "TaggedTextDocument")
importFrom("Rcpp", "evalCpp")
importFrom("graphics", "abline", "plot")
importFrom("parallel", "parLapply")
importFrom("stats", "coef", "cor", "lm", "setNames")
importFrom("utils", "download.file", "getS3method", "unzip")
importFrom("slam", "as.simple_triplet_matrix", "col_sums",
           "crossapply_simple_triplet_matrix", "read_stm_MC", "rollup",
           "row_sums", "simple_triplet_matrix")
importFrom("xml2",
           "read_xml",
           "xml_contents",
           "xml_find_all",
           "xml_missing",
           "xml_text")

export("as.DocumentTermMatrix",
       "as.TermDocumentMatrix",
       "as.VCorpus",
       "Boost_tokenizer",
       "content_transformer",
       "Corpus",
       "DataframeSource",
       "DirSource",
       "Docs",
       "DocumentTermMatrix",
       "DublinCore",
       "DublinCore<-",
       "eoi",
       "FunctionGenerator",
       "getElem",
       "getMeta",
       "Heaps_plot",
       "findAssocs",
       "findFreqTerms",
       "findMostFreqTerms",
       "getReaders",
       "getSources",
       "getTokenizers",
       "getTransformations",
       "inspect",
       "MC_tokenizer",
       "nDocs",
       "nTerms",
       "PCorpus",
       "pGetElem",
       "PlainTextDocument",
       "read_dtm_Blei_et_al",
       "read_dtm_MC",
       "readDataframe",
       "readDOC",
       "reader",
       "readPlain",
       "readReut21578XML",
       "readReut21578XMLasPlain",
       "readRCV1",
       "readRCV1asPlain",
       "readPDF",
       "readTagged",
       "readXML",
       "removeNumbers",
       "removePunctuation",
       "removeSparseTerms",
       "removeWords",
       "scan_tokenizer",
       "SimpleCorpus",
       "SimpleSource",
       "stemCompletion",
       "stemDocument",
       "stepNext",
       "stopwords",
       "stripWhitespace",
       "TermDocumentMatrix",
       "termFreq",
       "Terms",
       "tm_filter",
       "tm_index",
       "tm_map",
       "tm_parLapply",
       "tm_parLapply_engine",
       "tm_reduce",
       "tm_term_score",
       "URISource",
       "VCorpus",
       "VectorSource",
       "WeightFunction",
       "weightTf",
       "weightTfIdf",
       "weightBin",
       "weightSMART",
       "writeCorpus",
       "XMLSource",
       "XMLTextDocument",
       "Zipf_plot",
       "ZipSource")

S3method("removeNumbers", "character")
S3method("removePunctuation", "character")
S3method("removeWords", "character")
S3method("stemDocument", "character")
S3method("stripWhitespace", "character")
S3method("words", "character")

S3method("[", "DataframeSource")
S3method("[[", "DataframeSource")
S3method("getElem", "DataframeSource")
S3method("getMeta", "DataframeSource")
S3method("pGetElem", "DataframeSource")

S3method("[", "DirSource")
S3method("[[", "DirSource")
S3method("getElem", "DirSource")
S3method("pGetElem", "DirSource")

S3method("[", "DocumentTermMatrix")
S3method("c", "DocumentTermMatrix")
S3method("dimnames<-", "DocumentTermMatrix")
S3method("findAssocs", "DocumentTermMatrix")
S3method("findMostFreqTerms", "DocumentTermMatrix")
S3method("inspect", "DocumentTermMatrix")
S3method("plot", "DocumentTermMatrix")
S3method("print", "DocumentTermMatrix")
S3method("t", "DocumentTermMatrix")
S3method("tm_term_score", "DocumentTermMatrix")

S3method("as.VCorpus", "list")

S3method("tm_term_score", "term_frequency")

S3method("[", "PCorpus")
S3method("[[", "PCorpus")
S3method("[[<-", "PCorpus")
S3method("as.list", "PCorpus")
S3method("content", "PCorpus")
S3method("format", "PCorpus")
S3method("inspect", "PCorpus")
S3method("length", "PCorpus")
S3method("meta", "PCorpus")
S3method("meta<-", "PCorpus")
S3method("names", "PCorpus")
S3method("names<-", "PCorpus")
S3method("print", "PCorpus", .print_via_format)
S3method("TermDocumentMatrix", "PCorpus")
S3method("tm_filter", "PCorpus")
S3method("tm_index", "PCorpus")
S3method("tm_map", "PCorpus")

S3method("as.character", "PlainTextDocument")
S3method("content", "PlainTextDocument")
S3method("content<-", "PlainTextDocument")
S3method("format", "PlainTextDocument")
S3method("meta", "PlainTextDocument")
S3method("meta<-", "PlainTextDocument")
S3method("print", "PlainTextDocument", .print_via_format)
S3method("removeNumbers", "PlainTextDocument")
S3method("removePunctuation", "PlainTextDocument")
S3method("removeWords", "PlainTextDocument")
S3method("stemDocument", "PlainTextDocument")
S3method("stripWhitespace", "PlainTextDocument")
S3method("tm_term_score", "PlainTextDocument")
S3method("words", "PlainTextDocument")

S3method("[", "SimpleCorpus")
S3method("[[", "SimpleCorpus")
S3method("[[<-", "SimpleCorpus")
S3method("as.list", "SimpleCorpus")
S3method("content", "SimpleCorpus")
S3method("format", "SimpleCorpus")
S3method("inspect", "SimpleCorpus")
S3method("length", "SimpleCorpus")
S3method("meta", "SimpleCorpus")
S3method("meta<-", "SimpleCorpus")
S3method("names", "SimpleCorpus")
S3method("print", "SimpleCorpus", .print_via_format)
S3method("TermDocumentMatrix", "SimpleCorpus")
S3method("tm_filter", "SimpleCorpus")
S3method("tm_index", "SimpleCorpus")
S3method("tm_map", "SimpleCorpus")

S3method("close", "SimpleSource")
S3method("eoi", "SimpleSource")
S3method("length", "SimpleSource")
S3method("open", "SimpleSource")
S3method("reader", "SimpleSource")
S3method("stepNext", "SimpleSource")

S3method("c", "TermDocumentMatrix")
S3method("[", "TermDocumentMatrix")
S3method("dimnames<-", "TermDocumentMatrix")
S3method("findAssocs", "TermDocumentMatrix")
S3method("findMostFreqTerms", "TermDocumentMatrix")
S3method("inspect", "TermDocumentMatrix")
S3method("plot", "TermDocumentMatrix")
S3method("print", "TermDocumentMatrix")
S3method("t", "TermDocumentMatrix")
S3method("tm_term_score", "TermDocumentMatrix")

S3method("c", "term_frequency")
S3method("findMostFreqTerms", "term_frequency")

S3method("c", "TextDocument")
S3method("inspect", "TextDocument")

S3method("print", "TextDocumentMeta")

S3method("[", "URISource")
S3method("[[", "URISource")
S3method("getElem", "URISource")
S3method("pGetElem", "URISource")

S3method("[", "VCorpus")
S3method("[[", "VCorpus")
S3method("[[<-", "VCorpus")
S3method("as.list", "VCorpus")
S3method("as.VCorpus", "VCorpus")
S3method("c", "VCorpus")
S3method("content", "VCorpus")
S3method("format", "VCorpus")
S3method("inspect", "VCorpus")
S3method("length", "VCorpus")
S3method("meta", "VCorpus")
S3method("meta<-", "VCorpus")
S3method("names", "VCorpus")
S3method("names<-", "VCorpus")
S3method("print", "VCorpus", .print_via_format)
S3method("TermDocumentMatrix", "VCorpus")
S3method("tm_filter", "VCorpus")
S3method("tm_index", "VCorpus")
S3method("tm_map", "VCorpus")

S3method("[", "VectorSource")
S3method("[[", "VectorSource")
S3method("getElem", "VectorSource")
S3method("pGetElem", "VectorSource")

S3method("getElem", "XMLSource")

S3method("as.character", "XMLTextDocument")
S3method("content", "XMLTextDocument")
S3method("content<-", "XMLTextDocument")
S3method("format", "XMLTextDocument")
S3method("meta", "XMLTextDocument")
S3method("meta<-", "XMLTextDocument")
S3method("print", "XMLTextDocument", .print_via_format)

S3method("close", "ZipSource")
S3method("getElem", "ZipSource")
S3method("open", "ZipSource")
S3method("pGetElem", "ZipSource")

S3method("as.DocumentTermMatrix", "DocumentTermMatrix")
S3method("as.DocumentTermMatrix", "TermDocumentMatrix")
S3method("as.DocumentTermMatrix", "default")
S3method("as.DocumentTermMatrix", "term_frequency")
S3method("as.DocumentTermMatrix", "textcnt")
S3method("as.TermDocumentMatrix", "TermDocumentMatrix")
S3method("as.TermDocumentMatrix", "DocumentTermMatrix")
S3method("as.TermDocumentMatrix", "default")
S3method("as.TermDocumentMatrix", "term_frequency")
S3method("as.TermDocumentMatrix", "textcnt")

S3method("Docs", "DocumentTermMatrix")
S3method("Docs", "TermDocumentMatrix")
S3method("Terms", "DocumentTermMatrix")
S3method("Terms", "TermDocumentMatrix")
S3method("nDocs", "DocumentTermMatrix")
S3method("nDocs", "TermDocumentMatrix")
S3method("nTerms", "DocumentTermMatrix")
S3method("nTerms", "TermDocumentMatrix")
