Home

Awesome

<a href="https://www.simform.com/"><img src="https://github.com/SimformSolutionsPvtLtd/SSToastMessage/blob/master/simformBanner.png"></a>

SSNaturalLanguage

The SSNaturalLanguage framework let you provide a variety of natural language processing functionality with support for many different languages and scripts. Use SSNaturalLanguage framework to segment natural language text into paragraphs, sentences or words and tag information about those segments such as part of speech, lexical class, lemma, script and language.

<p align="left"> <a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/Swift_5-compatible-4BC51D.svg?style=flat" alt="Swift 5 compatible" /></a> <img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" /> <a href="https://raw.githubusercontent.com/maxsokolov/tablekit/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a> </p>

Requirements

Installation

CocoaPods

Manually

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/SimformSolutionsPvtLtd/SSNaturalLanguage.git", from: "1.0.0")
]

Carthage

$ brew update
$ brew install carthage

To integrate SSNaturalLanguage into your Xcode project using Carthage, add the following line to your Cartfile:

github "SimformSolutionsPvtLtd/SSNaturalLanguage"

Run carthage to build and drag the SSNaturalLanguage(Sources/SSNaturalLanguage) into your Xcode project.

How It Works

1. Split Text

import SSNaturalLanguage
var text = "How are you? Where were you?"
let arrSplitText = text.splitInto(unit: .sentence)

2. Base Form

var text = "I am running late for the 10 km marathon run that was scheduled for today. Can we reschedule the meeting?"
let arrBaseForm = text.toBaseForm()
I - I
am - be
running - run
late - late
for - for
the - the
marathon - marathon
run - run
that - that
was - be
scheduled - schedule
for - for
today - today
Can - can
we - we
reschedule - reschedule
the - the
meeting - meeting

3. Language Identification

var text = "Gracias"
let languageCode = text.identifyLanguage()
print(languageCode) ==> "es"
Locale.current.localizedString(forIdentifier: languageCode)) ==> "Spanish"

4. Predicted Language

var text = "Mart Goorsqu'ent avainq ce mennoci faucte. pirrin to l'onçair-là der mosepe, qués, audeu! of therci; this asiblio whot fore; Mme jecome de da vidger. Cohe witid-hus joir."
let arrPredictedLangs = text.predictedLanguage(maxPredictCount: 2)

5. Spell Correction

let text = """
I started my schooling as the majority did in my area, at the local primarry school. I then
went to the local secondarry school and recieved grades in English, Maths, Phisics,
Biology, Geography, Art, Graphical Comunication and Philosophy of Religeon. I'll not
bore you with the 'A' levels and above.
"""
let correctText = text.correctSpell()

Result: I started my schooling as the majority did in my area, at the local primary school. I then went to the local secondary school and received grades in English, Maths, Physics, Biology, Geography, Art, Graphical Communication and Philosophy of Religion. I'll not bore you with the 'A' levels and above.

6. Part Of Speech (POS) Tagging

let text = "Hello world, I am a data scientist. I work with machine learning!"
let pos = text.partOfSpeech()

Result: 
Hello - Interjection
world - Noun
I - Pronoun
am - Verb
a - Determiner
data - Noun
scientist - Noun
I - Pronoun
work - Verb
with - Preposition
machine - Noun
learning - Noun

7. Identify person Entity

let text = "Jackie, are you leaving so soon?"
let arrPersonName = text.recognizePersonName()

Result:
["Jackie"]

8. Identify placeName

let text = "Apple is looking at buying U.K. startup for $1 billion."
let arrPlaceName = text.recognizePlaceName()

Result:
["U.K."]

9. Identify Organization Name

let text = "Apple is looking at buying U.K. startup for $1 billion."
let arrOrganizationName = text.recognizeOrganizationName()

Result:
["Apple"]

10. Sentimental Analysis

let text = "I hate this apple pie."
let sentimentalScore = text.sentimentalScore()
print(sentimentalScore) ==> -0.6

11. Word Embedding

Alt text

let word = "cheese"
let arrSimilarWords = word.neighboringWords(maximumResult: 5)

Result:
[(word: "mozzarella", distance: 0.631902277469635), (word: "cheddar", distance: 0.6747748851776123), (word: "provolone", distance: 0.6827872395515442), (word: "ricotta", distance: 0.6940725445747375), (word: "focaccia", distance: 0.7102253437042236)]

11. Unique Tags

let text = "I love machine learning and I work as a Data Scientist in India."
let arrUniqueWord = text.findUniqueTag()

Result:
["Machine", "Learning", "Scientist", "India", "Data"]

Find this library useful? :heart:

Support it by joining stargazers for this repository. :star:

License