Last active
November 26, 2019 06:50
-
-
Save mohdsanadzakirizvi/87bb5cb9f6a2fe1cc3ae4ccb89384f95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import the NaturalLanguage library | |
import NaturalLanguage | |
let text = """ | |
Analytics Vidhya provides a community based knowledge portal for Analytics and Data Science professionals. The aim of the platform is to become a complete portal serving all knowledge and career needs of Data Science Professionals. | |
""" | |
// Initialize the tokenizer with unit of "word" | |
let tokenizer = NLTokenizer(unit: .word) | |
// Set the string to be processed | |
tokenizer.string = text | |
// Loop over all the tokens and print them | |
tokenizer.enumerateTokens(in: text.startIndex..<text.endIndex) { tokenRange, _ in | |
print(text[tokenRange]) | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment