Creating, inverting, and using dictionaries

Dictionaries hold key-value pairs where the key is the index. An inverted dictionary is one where the values become the keys and the keys becomes the values. Dictionaries are frequently used to support many NLP tasks. For example, in the previous recipe, Summarizing text in a document, the LinkedHashMap class was used internally to maintain the word frequency with respect to the number of occurrences for text.

In this recipe, we will explore how dictionaries and inverted dictionaries are handled in Java. We will use the Java core SDK and the Guava (Google core libraries for Java and API for our libraries). The Guava website is found at https://github.com/google/guava.

Problems can arise when the values are not unique. We will use the Java 8 Streams to address these issues.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.205.228