From 28cc3eb5a6f517b425b0ecbcb855d03d69bfadd2 Mon Sep 17 00:00:00 2001 From: Gabi Gutu Date: Fri, 20 Jul 2018 14:57:08 +0300 Subject: [PATCH 1/3] Incorporated sentiment valence description and basic description for Valence ANEW --- .../sentiment_valences_descriptions_en.properties | 1 + .../textualcomplexity/wordLists/WordValences.java | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 textual-complexity/src/main/config/sentiment_valences_descriptions_en.properties diff --git a/textual-complexity/src/main/config/sentiment_valences_descriptions_en.properties b/textual-complexity/src/main/config/sentiment_valences_descriptions_en.properties new file mode 100644 index 00000000..75e0bfd8 --- /dev/null +++ b/textual-complexity/src/main/config/sentiment_valences_descriptions_en.properties @@ -0,0 +1 @@ +Valence_ANEW=Affective Norms for English Words Valence diff --git a/textual-complexity/src/main/java/com/readerbench/textualcomplexity/wordLists/WordValences.java b/textual-complexity/src/main/java/com/readerbench/textualcomplexity/wordLists/WordValences.java index ce7b947e..75ffbf2c 100644 --- a/textual-complexity/src/main/java/com/readerbench/textualcomplexity/wordLists/WordValences.java +++ b/textual-complexity/src/main/java/com/readerbench/textualcomplexity/wordLists/WordValences.java @@ -5,9 +5,11 @@ */ package com.readerbench.textualcomplexity.wordLists; +import com.readerbench.coreservices.data.AbstractDocument; import com.readerbench.coreservices.data.Word; import com.readerbench.datasourceprovider.commons.ReadProperty; import com.readerbench.datasourceprovider.pojo.Lang; +import com.readerbench.textualcomplexity.ComplexityIndex; import java.io.*; import java.util.ArrayList; @@ -17,6 +19,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; @@ -27,7 +30,7 @@ public class WordValences { private static final Map>> WORD_VALENCE_MAP = new EnumMap<>(Lang.class); - private static final Map> VALENCES_FOR_LANG = new EnumMap<>(Lang.class); + private static final Map> VALENCES_FOR_LANG = new EnumMap<>(Lang.class); private static final Properties PROPERTIES = ReadProperty.getProperties("textual_complexity_paths.properties"); private static final String PROPERTY_VALENCES_NAME = "VALENCES_%s_PATH"; public static final List SUPPORTED_LANGUAGES = Arrays.asList(Lang.en, Lang.fr, Lang.es); @@ -44,9 +47,9 @@ private static void initLang(Lang lang) { header = in.readLine(); } String[] splitHeader = header.split(";"); - ArrayList valences = new ArrayList<>(); + Map valences = new HashMap<>(); for (int i = 1; i < splitHeader.length; i++) { - valences.add(splitHeader[i]); + valences.put(splitHeader[i], ResourceBundle.getBundle("sentiment_valences_descriptions", lang.getLocale()).getString(splitHeader[i])); } VALENCES_FOR_LANG.put(lang, valences); String line; @@ -74,7 +77,7 @@ public static Double getValenceForWord(Word word, String valence) { .getOrDefault(valence, 0.); } - public static List getValences(Lang lang) { + public static Map getValences(Lang lang) { if (!VALENCES_FOR_LANG.containsKey(lang)) { initLang(lang); } From 2721df36c1100d4144f46324d43cb26d73a284af Mon Sep 17 00:00:00 2001 From: Gabi Gutu Date: Fri, 20 Jul 2018 15:00:33 +0300 Subject: [PATCH 2/3] Fix for Word Lists Indices Factory to be incorporated in Complexity Index --- .../textualcomplexity/wordLists/WordListsIndicesFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textual-complexity/src/main/java/com/readerbench/textualcomplexity/wordLists/WordListsIndicesFactory.java b/textual-complexity/src/main/java/com/readerbench/textualcomplexity/wordLists/WordListsIndicesFactory.java index 3818906c..1a833d8d 100644 --- a/textual-complexity/src/main/java/com/readerbench/textualcomplexity/wordLists/WordListsIndicesFactory.java +++ b/textual-complexity/src/main/java/com/readerbench/textualcomplexity/wordLists/WordListsIndicesFactory.java @@ -27,7 +27,7 @@ public List build(Lang lang) { if (!WordValences.SUPPORTED_LANGUAGES.contains(lang)) { return result; } - WordValences.getValences(lang).stream() + WordValences.getValences(lang).keySet().stream() .forEach(sv -> { result.add(new AvgWordsInList( ComplexityIndicesEnum.AVG_WORDS_IN_LIST_PER_DOC, From 4b793ec9580a2859581d35da97a4f24ce62d15f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Jan 2022 17:03:49 +0000 Subject: [PATCH 3/3] Bump log4j-api from 2.11.0 to 2.17.1 Bumps log4j-api from 2.11.0 to 2.17.1. --- updated-dependencies: - dependency-name: org.apache.logging.log4j:log4j-api dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8619c9d3..baa03c1c 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ 1.7.25 2.11.0 - 2.11.0 + 2.17.1 4.12 2.5.2