code: public static Map<String, Integer> loadRankedDictionary(final String fileName)
      {
          Map<String, Integer> ranked = new HashMap<>();
          String path = "/dictionaries/" + fileName;
          try (InputStream is = DictionaryUtil.class.getResourceAsStream(path);
               BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")))
          {
              String line;
              int i = 1;
              while ((line = br.readLine()) != null)
              {
                  ranked.put(line, i++);
              }
          }
          catch (IOException e)
          {
              System.out.println("Error while reading " + fileName);
          }
  
          return ranked;
      }
docs: Read a resource file with a list of entries (sorted by frequency) and use
  it to create a ranked dictionary.
  <p>
  The dictionary must contain only lower case values for the matching to work properly.
  
  @param fileName the name of the file
  @return the ranked dictionary (a {@code HashMap} which associated a
  rank to each entry