Language (afinn v0.3.0)

Handles loading and parsing of AFINN sentiment dictionaries for different languages.

This module provides functionality to read AFINN dictionary files and convert them into maps for efficient sentiment lookups.

Summary

Functions

Reads and parses the AFINN dictionary for the specified language.

Functions

read_dictionaries(language)

@spec read_dictionaries(:en | :dk | :fi | :fr | :pl | :sv | :tr | :emoticon) :: %{
  required(String.t()) => integer()
}

Reads and parses the AFINN dictionary for the specified language.

Parameters

  • language - Language identifier (:en for English, :dk for Danish, :fi for Finnish, :fr for French, :pl for Polish, :sv for Swedish, :tr for Turkish, :emoticon for Emoticons)

Returns

A map where keys are words (strings) and values are sentiment scores (integers).

Examples

iex> dict = Language.read_dictionaries(:en)
iex> Map.get(dict, "love")
3