Skip to content

Classifier is not working as expected #25

@tosbaha

Description

@tosbaha

Even though I write the exat same sentence, classifier can't identify string's category.

let prepared = ["file is packed",
            "Data Prepared",
            "information Arranged",
            "Record Created",
            "Data received"]
        let inhouse = ["Data is waiting",
            "Received at some location",
            "Received by somebody",
            "Package arrived"]
        trainCategory(prepared, category: "prepared")
        trainCategory(inhouse, category: "inhouse")

 let category = classifier.classify("Data is waiting")
        println(category) // it prints prepared

  private func trainCategory(items:[String], category:String) {
        for item in items {
            classifier.trainWithText(item, category:category)
        }
    }

PS: In Swift, documentation uses different syntax. For example following comment

    /**
        Returns the tokens for the input text using the specified linguistic tagger options.
        @param text Text to tokenize
        @param options Linguistic tagger options
        @return The tokens
    */

should be converted to

    /**
        Returns the tokens for the input text using the specified linguistic tagger options.

        :param: text Text to tokenize
        :param: options Linguistic tagger options
        :returns: The tokens
    */

For more information you may check http://nshipster.com/swift-documentation/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions