axyseo 2.0.0-alpha.0.0.9 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/languageProcessing/helpers/highlighting/getMarkingsInSentence.js +1 -1
- package/build/languageProcessing/helpers/highlighting/getMarkingsInSentence.js.map +1 -1
- package/build/languageProcessing/helpers/morphology/buildTopicStems.js +1 -1
- package/build/languageProcessing/helpers/morphology/buildTopicStems.js.map +1 -1
- package/build/languageProcessing/helpers/morphology/getAllWordsFromPaper.js +1 -1
- package/build/languageProcessing/helpers/morphology/getAllWordsFromPaper.js.map +1 -1
- package/build/languageProcessing/languages/_default/Researcher.js +1 -1
- package/build/languageProcessing/languages/_default/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/_default/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/_default/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/ar/Researcher.js +1 -1
- package/build/languageProcessing/languages/ar/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/ar/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/ar/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/ar/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/ar/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/ca/Researcher.js +1 -1
- package/build/languageProcessing/languages/ca/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/ca/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/ca/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/cs/Researcher.js +1 -1
- package/build/languageProcessing/languages/cs/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/cs/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/cs/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/cs/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/cs/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/cs/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/cs/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/cs/values/Clause.js +1 -1
- package/build/languageProcessing/languages/cs/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/de/Researcher.js +1 -1
- package/build/languageProcessing/languages/de/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/calculateFleschReadingScore.js +1 -1
- package/build/languageProcessing/languages/de/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/de/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/de/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/internal/determineStem.js +1 -1
- package/build/languageProcessing/languages/de/helpers/internal/determineStem.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/de/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/de/values/Clause.js +1 -1
- package/build/languageProcessing/languages/de/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/el/Researcher.js +1 -1
- package/build/languageProcessing/languages/el/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/el/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/el/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/el/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/el/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/el/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/el/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/el/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/el/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/el/values/Clause.js +1 -1
- package/build/languageProcessing/languages/el/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/en/Researcher.js +1 -1
- package/build/languageProcessing/languages/en/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/calculateFleschReadingScore.js +1 -1
- package/build/languageProcessing/languages/en/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/en/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/en/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/determineStem.js +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/determineStem.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getAdjectiveStem.js +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getAdjectiveStem.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getVerbStem.js +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getVerbStem.js.map +1 -1
- package/build/languageProcessing/languages/en/values/Clause.js +1 -1
- package/build/languageProcessing/languages/en/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/es/Researcher.js +1 -1
- package/build/languageProcessing/languages/es/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/calculateFleschReadingScore.js +1 -1
- package/build/languageProcessing/languages/es/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/es/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/es/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/checkVerbStemModifications.js +3 -3
- package/build/languageProcessing/languages/es/helpers/internal/checkVerbStemModifications.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/es/values/Clause.js +1 -1
- package/build/languageProcessing/languages/es/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/fa/Researcher.js +1 -1
- package/build/languageProcessing/languages/fa/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/fa/helpers/createBasicWordForms.js +1 -1
- package/build/languageProcessing/languages/fa/helpers/createBasicWordForms.js.map +1 -1
- package/build/languageProcessing/languages/fa/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/fa/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/fa/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/fa/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/fr/Researcher.js +1 -1
- package/build/languageProcessing/languages/fr/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/calculateFleschReadingScore.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/fr/values/Clause.js +1 -1
- package/build/languageProcessing/languages/fr/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/he/Researcher.js +1 -1
- package/build/languageProcessing/languages/he/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/he/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/he/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/he/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/he/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/hu/Researcher.js +1 -1
- package/build/languageProcessing/languages/hu/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/hu/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/hu/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/hu/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/hu/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/hu/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/hu/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/hu/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/hu/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/hu/values/Clause.js +1 -1
- package/build/languageProcessing/languages/hu/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/id/Researcher.js +1 -1
- package/build/languageProcessing/languages/id/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/id/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/id/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/id/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/id/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/id/helpers/internal/stemHelpers.js +1 -1
- package/build/languageProcessing/languages/id/helpers/internal/stemHelpers.js.map +1 -1
- package/build/languageProcessing/languages/id/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/id/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/it/Researcher.js +1 -1
- package/build/languageProcessing/languages/it/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/it/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/it/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/it/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/it/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/it/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/it/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/it/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/it/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/it/values/Clause.js +1 -1
- package/build/languageProcessing/languages/it/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/ja/Researcher.js +1 -1
- package/build/languageProcessing/languages/ja/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/ja/helpers/countCharacters.js +1 -1
- package/build/languageProcessing/languages/ja/helpers/countCharacters.js.map +1 -1
- package/build/languageProcessing/languages/ja/helpers/customGetStemmer.js +1 -1
- package/build/languageProcessing/languages/ja/helpers/customGetStemmer.js.map +1 -1
- package/build/languageProcessing/languages/ja/helpers/getWords.js +1 -1
- package/build/languageProcessing/languages/ja/helpers/getWords.js.map +1 -1
- package/build/languageProcessing/languages/nb/Researcher.js +1 -1
- package/build/languageProcessing/languages/nb/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/nb/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/nb/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/nb/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/nb/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/nb/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/nb/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/nb/values/Clause.js +1 -1
- package/build/languageProcessing/languages/nb/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/nl/Researcher.js +1 -1
- package/build/languageProcessing/languages/nl/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/checkExceptionsWithFullForms.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/checkExceptionsWithFullForms.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/detectAndStemRegularParticiple.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/detectAndStemRegularParticiple.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/determineStem.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/determineStem.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/getStemWordsWithTAndDEnding.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/getStemWordsWithTAndDEnding.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stemModificationHelpers.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stemModificationHelpers.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stemTOrDFromEndOfWord.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stemTOrDFromEndOfWord.js.map +1 -1
- package/build/languageProcessing/languages/nl/values/Clause.js +1 -1
- package/build/languageProcessing/languages/nl/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/pl/Researcher.js +1 -1
- package/build/languageProcessing/languages/pl/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/pl/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/pl/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/pl/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/pl/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/pl/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/pl/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/pl/values/Clause.js +1 -1
- package/build/languageProcessing/languages/pl/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/pt/Researcher.js +1 -1
- package/build/languageProcessing/languages/pt/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/pt/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/pt/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/pt/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/pt/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/pt/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/pt/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/pt/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/pt/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/pt/values/Clause.js +1 -1
- package/build/languageProcessing/languages/pt/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/ru/Researcher.js +1 -1
- package/build/languageProcessing/languages/ru/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/ru/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/ru/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/ru/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/ru/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/sk/Researcher.js +1 -1
- package/build/languageProcessing/languages/sk/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/sk/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/sk/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/sk/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/sk/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/sk/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/sk/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/sk/values/Clause.js +1 -1
- package/build/languageProcessing/languages/sk/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/sv/Researcher.js +1 -1
- package/build/languageProcessing/languages/sv/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/sv/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/sv/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/sv/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/sv/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/tr/Researcher.js +1 -1
- package/build/languageProcessing/languages/tr/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/tr/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/tr/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/tr/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/tr/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/tr/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/tr/helpers/isPassiveSentence.js.map +1 -1
- package/build/parsedPaper/build/linguisticParsing/SentenceTokenizer.js +1 -1
- package/build/parsedPaper/build/linguisticParsing/SentenceTokenizer.js.map +1 -1
- package/build/parsedPaper/build/tree/metadata/buildTree.js +1 -1
- package/build/parsedPaper/build/tree/metadata/buildTree.js.map +1 -1
- package/build/scoring/assessments/assessment.js +1 -1
- package/build/scoring/assessments/assessment.js.map +1 -1
- package/build/scoring/assessments/index.js +5 -5
- package/build/scoring/assessments/index.js.map +1 -1
- package/build/scoring/assessments/readability/TransitionWordsAssessment.js +3 -3
- package/build/scoring/assessments/readability/TransitionWordsAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaDescriptionKeywordAssessment.js +1 -1
- package/build/scoring/assessments/seo/MetaDescriptionKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaTitleKeywordAssessment.js +1 -1
- package/build/scoring/assessments/seo/MetaTitleKeywordAssessment.js.map +1 -1
- package/build/scoring/assessors/avadaAssessor.js +2 -2
- package/build/scoring/assessors/avadaAssessor.js.map +1 -1
- package/build/scoring/assessors/seoAssessor.js +6 -6
- package/build/scoring/assessors/seoAssessor.js.map +1 -1
- package/build/scoring/helpers/assessments/recommendedKeywordCount.js +1 -1
- package/build/scoring/helpers/assessments/recommendedKeywordCount.js.map +1 -1
- package/build/scoring/helpers/index.js +1 -1
- package/build/scoring/helpers/index.js.map +1 -1
- package/package.json +2 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"determineStem.js","names":["_lodash","require","_index","_detectAndStemRegularParticiple","_stem","_interopRequireDefault","e","__esModule","default","flattenSortLength","languageProcessing","findStemOnNounExceptionList","morphologyDataNouns","stemmedWord","exceptionStems","exceptionStemSet","matchedStem","find","exceptionStem","endsWith","precedingLexicalMaterial","slice","length","findStemOnAdjectiveExceptionList","morphologyDataAdjectives","adjectiveExceptionClasses","exceptions","key","Object","keys","includes","findStemOnVerbExceptionList","morphologyDataVerbs","wordToCheck","strongAndIrregularVerbStems","strongAndIrregularVerbs","stems","prefixes","matchedPrefix","prefix","startsWith","wordWithoutPrefix","strongOrIrregularVerbParadigm","flatten","values","present","determineStem","word","morphologyDataGerman","verbData","verbs","stem","nouns","adjectives","detectAndStemRegularParticiple"],"sources":["../../../../../../src/languageProcessing/languages/de/helpers/internal/determineStem.js"],"sourcesContent":["import {flatten} from 'lodash';\nimport {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"determineStem.js","names":["_lodash","require","_index","_detectAndStemRegularParticiple","_stem","_interopRequireDefault","e","__esModule","default","flattenSortLength","languageProcessing","findStemOnNounExceptionList","morphologyDataNouns","stemmedWord","exceptionStems","exceptionStemSet","matchedStem","find","exceptionStem","endsWith","precedingLexicalMaterial","slice","length","findStemOnAdjectiveExceptionList","morphologyDataAdjectives","adjectiveExceptionClasses","exceptions","key","Object","keys","includes","findStemOnVerbExceptionList","morphologyDataVerbs","wordToCheck","strongAndIrregularVerbStems","strongAndIrregularVerbs","stems","prefixes","matchedPrefix","prefix","startsWith","wordWithoutPrefix","strongOrIrregularVerbParadigm","flatten","values","present","determineStem","word","morphologyDataGerman","verbData","verbs","stem","nouns","adjectives","detectAndStemRegularParticiple"],"sources":["../../../../../../src/languageProcessing/languages/de/helpers/internal/determineStem.js"],"sourcesContent":["import {flatten} from 'lodash';\nimport {languageProcessing} from '../../../index';\nconst {flattenSortLength} = languageProcessing;\n\nimport {detectAndStemRegularParticiple} from './detectAndStemRegularParticiple';\n\nimport stem from './stem';\n\n/**\n * Returns a stem for a word that appears on the noun exception lists.\n *\n * @param {Object} morphologyDataNouns The German morphology data for nouns.\n * @param {string} stemmedWord The stem to check.\n *\n * @returns {string|null} The stemmed word or null if none was found.\n */\nconst findStemOnNounExceptionList = function(morphologyDataNouns, stemmedWord) {\n const exceptionStems = morphologyDataNouns.exceptionStems;\n\n for (const exceptionStemSet of exceptionStems) {\n const matchedStem = exceptionStemSet.find(exceptionStem => stemmedWord.endsWith(exceptionStem));\n\n if (matchedStem) {\n const precedingLexicalMaterial = stemmedWord.slice(\n 0,\n stemmedWord.length - matchedStem.length\n );\n\n return precedingLexicalMaterial + exceptionStemSet[0];\n }\n }\n\n return null;\n};\n\n/**\n * Returns a stem for a word that appears on the adjective exception lists.\n *\n * @param {Object} morphologyDataAdjectives The German morphology data for adjectives.\n * @param {string} stemmedWord The stem to check.\n *\n * @returns {string|null} The stemmed word or null if none was found.\n */\nconst findStemOnAdjectiveExceptionList = function(morphologyDataAdjectives, stemmedWord) {\n const adjectiveExceptionClasses = morphologyDataAdjectives.exceptions;\n\n for (const key of Object.keys(adjectiveExceptionClasses)) {\n const exceptionStems = adjectiveExceptionClasses[key];\n\n for (const exceptionStemSet of exceptionStems) {\n if (exceptionStemSet.includes(stemmedWord)) {\n return exceptionStemSet[0];\n }\n }\n }\n\n return null;\n};\n\n/**\n * Returns a stem for a word that appears on the verb exception lists.\n *\n * @param {Object} morphologyDataVerbs The German morphology data for verbs.\n * @param {string} stemmedWord The stem to check.\n *\n * @returns {string|null} The stemmed word or null if none was found.\n */\nconst findStemOnVerbExceptionList = function(morphologyDataVerbs, stemmedWord) {\n let wordToCheck = stemmedWord;\n const strongAndIrregularVerbStems = morphologyDataVerbs.strongAndIrregularVerbs.stems;\n const prefixes = flattenSortLength(morphologyDataVerbs.prefixes);\n\n let matchedPrefix = prefixes.find(prefix => stemmedWord.startsWith(prefix));\n\n if (matchedPrefix) {\n const wordWithoutPrefix = wordToCheck.slice(matchedPrefix.length, wordToCheck.length);\n\n /* At least 3 characters so that e.g. \"be\" is not found in the stem \"berg\". A minimum length of 3 was chosen\n * as a safe option, since 2-letter verb stems are highly unlikely to impossible.\n */\n if (wordWithoutPrefix.length > 2) {\n wordToCheck = wordWithoutPrefix;\n } else {\n matchedPrefix = null;\n }\n }\n\n for (const strongOrIrregularVerbParadigm of strongAndIrregularVerbStems) {\n let stems = strongOrIrregularVerbParadigm.stems;\n stems = flatten(Object.values(stems));\n\n if (stems.includes(wordToCheck)) {\n if (matchedPrefix) {\n // The present tense stem is returned as a default stem.\n return matchedPrefix + strongOrIrregularVerbParadigm.stems.present;\n }\n\n return strongOrIrregularVerbParadigm.stems.present;\n }\n }\n\n return null;\n};\n\n/**\n * Returns the stem for a given German input word.\n *\n * @param {string} word The word to get the stem for.\n * @param {Object} morphologyDataGerman The German morphology data.\n *\n * @returns {string} Stemmed form of the word.\n */\nexport default function determineStem(word, morphologyDataGerman) {\n const verbData = morphologyDataGerman.verbs;\n const stemmedWord = stem(verbData, word);\n\n /*\n * Goes through the stem exception functions from left to right, returns the first stem it finds.\n * If no stem has been found, return the original, programmatically created, stem.\n */\n return (\n findStemOnNounExceptionList(morphologyDataGerman.nouns, stemmedWord) ||\n findStemOnAdjectiveExceptionList(morphologyDataGerman.adjectives, stemmedWord) ||\n findStemOnVerbExceptionList(verbData, stemmedWord) ||\n detectAndStemRegularParticiple(verbData, word) ||\n stemmedWord\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,+BAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAA0B,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAJ1B,MAAM;EAACG;AAAiB,CAAC,GAAGC,yBAAkB;AAM9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,GAAG,SAAAA,CAASC,mBAAmB,EAAEC,WAAW,EAAE;EAC7E,MAAMC,cAAc,GAAGF,mBAAmB,CAACE,cAAc;EAEzD,KAAK,MAAMC,gBAAgB,IAAID,cAAc,EAAE;IAC7C,MAAME,WAAW,GAAGD,gBAAgB,CAACE,IAAI,CAACC,aAAa,IAAIL,WAAW,CAACM,QAAQ,CAACD,aAAa,CAAC,CAAC;IAE/F,IAAIF,WAAW,EAAE;MACf,MAAMI,wBAAwB,GAAGP,WAAW,CAACQ,KAAK,CAChD,CAAC,EACDR,WAAW,CAACS,MAAM,GAAGN,WAAW,CAACM,MACnC,CAAC;MAED,OAAOF,wBAAwB,GAAGL,gBAAgB,CAAC,CAAC,CAAC;IACvD;EACF;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMQ,gCAAgC,GAAG,SAAAA,CAASC,wBAAwB,EAAEX,WAAW,EAAE;EACvF,MAAMY,yBAAyB,GAAGD,wBAAwB,CAACE,UAAU;EAErE,KAAK,MAAMC,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACJ,yB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a,GAAGI,6BAA6B,CAACN,KAAK,CAACS,OAAO;MACpE;MAEA,OAAOH,6BAA6B,CAACN,KAAK,CAACS,OAAO;IACpD;EACF;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,aAAaA,CAACC,IAAI,EAAEC,oBAAoB,EAAE;EAChE,MAAMC,QAAQ,GAAGD,oBAAoB,CAACE,KAAK;EAC3C,MAAMrC,WAAW,GAAG,IAAAsC,aAAI,EAACF,QAAQ,EAAEF,IAAI,CAAC;;EAExC;AACF;AACA;AACA;EACE,OACEpC,2BAA2B,CAACqC,oBAAoB,CAACI,KAAK,EAAEvC,WAAW,CAAC,IACpEU,gCAAgC,CAACyB,oBAAoB,CAACK,UAAU,EAAExC,WAAW,CAAC,IAC9EkB,2BAA2B,CAACkB,QAAQ,EAAEpC,WAAW,CAAC,IAClD,IAAAyC,8DAA8B,EAACL,QAAQ,EAAEF,IAAI,CAAC,IAC9ClC,WAAW;AAEf","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = _default;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _index = require("
|
|
8
|
+
var _index = require("../../../index");
|
|
9
9
|
var _passiveVoiceRegex = _interopRequireDefault(require("../../config/internal/passiveVoiceRegex.js"));
|
|
10
10
|
var _passiveVoiceIrregulars = _interopRequireDefault(require("../../config/internal/passiveVoiceIrregulars.js"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getParticiples.js","names":["_lodash","require","_index","_passiveVoiceRegex","_interopRequireDefault","_passiveVoiceIrregulars","e","__esModule","default","getWords","languageProcessing","regexFunction","regexFunctionFactory","verbsBeginningWithErVerEntBeZerHerUber","verbsBeginningWithGe","verbsWithGeInMiddle","verbsWithErVerEntBeZerHerUberInMiddle","verbsEndingWithIert","_default","clauseText","words","foundParticiples","forEach","word","length","irregularParticiples","includes","push"],"sources":["../../../../../../src/languageProcessing/languages/de/helpers/internal/getParticiples.js"],"sourcesContent":["import {forEach} from 'lodash';\nimport {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getParticiples.js","names":["_lodash","require","_index","_passiveVoiceRegex","_interopRequireDefault","_passiveVoiceIrregulars","e","__esModule","default","getWords","languageProcessing","regexFunction","regexFunctionFactory","verbsBeginningWithErVerEntBeZerHerUber","verbsBeginningWithGe","verbsWithGeInMiddle","verbsWithErVerEntBeZerHerUberInMiddle","verbsEndingWithIert","_default","clauseText","words","foundParticiples","forEach","word","length","irregularParticiples","includes","push"],"sources":["../../../../../../src/languageProcessing/languages/de/helpers/internal/getParticiples.js"],"sourcesContent":["import {forEach} from 'lodash';\nimport {languageProcessing} from '../../../index';\nconst {getWords} = languageProcessing;\n\nimport regexFunctionFactory from '../../config/internal/passiveVoiceRegex.js';\nconst regexFunction = regexFunctionFactory();\nimport irregularParticiples from '../../config/internal/passiveVoiceIrregulars.js';\n\nconst verbsBeginningWithErVerEntBeZerHerUber = regexFunction.verbsBeginningWithErVerEntBeZerHerUber;\nconst verbsBeginningWithGe = regexFunction.verbsBeginningWithGe;\nconst verbsWithGeInMiddle = regexFunction.verbsWithGeInMiddle;\nconst verbsWithErVerEntBeZerHerUberInMiddle = regexFunction.verbsWithErVerEntBeZerHerUberInMiddle;\nconst verbsEndingWithIert = regexFunction.verbsEndingWithIert;\n\n/**\n * Creates German participles array for the participles found in a clause.\n *\n * @param {string} clauseText The clause to finds participles in.\n *\n * @returns {Array} The array with the German participles found.\n */\nexport default function(clauseText) {\n const words = getWords(clauseText);\n\n const foundParticiples = [];\n\n forEach(words, function(word) {\n if (\n verbsBeginningWithGe(word).length !== 0 ||\n verbsWithGeInMiddle(word).length !== 0 ||\n verbsBeginningWithErVerEntBeZerHerUber(word).length !== 0 ||\n verbsWithErVerEntBeZerHerUberInMiddle(word).length !== 0 ||\n verbsEndingWithIert(word).length !== 0 ||\n irregularParticiples.includes(word)\n ) {\n foundParticiples.push(word);\n }\n });\n return foundParticiples;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,uBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAAmF,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAJnF,MAAM;EAACG;AAAQ,CAAC,GAAGC,yBAAkB;AAGrC,MAAMC,aAAa,GAAG,IAAAC,0BAAoB,EAAC,CAAC;AAG5C,MAAMC,sCAAsC,GAAGF,aAAa,CAACE,sCAAsC;AACnG,MAAMC,oBAAoB,GAAGH,aAAa,CAACG,oBAAoB;AAC/D,MAAMC,mBAAmB,GAAGJ,aAAa,CAACI,mBAAmB;AAC7D,MAAMC,qCAAqC,GAAGL,aAAa,CAACK,qCAAqC;AACjG,MAAMC,mBAAmB,GAAGN,aAAa,CAACM,mBAAmB;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAAC,SAASC,UAAU,EAAE;EAClC,MAAMC,KAAK,GAAGX,QAAQ,CAACU,UAAU,CAAC;EAElC,MAAME,gBAAgB,GAAG,EAAE;EAE3B,IAAAC,eAAO,EAACF,KAAK,EAAE,UAASG,IAAI,EAAE;IAC5B,IACET,oBAAoB,CAACS,IAAI,CAAC,CAACC,MAAM,KAAK,CAAC,IACvCT,mBAAmB,CAACQ,IAAI,CAAC,CAACC,MAAM,KAAK,CAAC,IACtCX,sCAAsC,CAACU,IAAI,CAAC,CAACC,MAAM,KAAK,CAAC,IACzDR,qCAAqC,CAACO,IAAI,CAAC,CAACC,MAAM,KAAK,CAAC,IACxDP,mBAAmB,CAACM,IAAI,CAAC,CAACC,MAAM,KAAK,CAAC,IACtCC,+BAAoB,CAACC,QAAQ,CAACH,IAAI,CAAC,EACnC;MACAF,gBAAgB,CAACM,IAAI,CAACJ,IAAI,CAAC;IAC7B;EACF,CAAC,CAAC;EACF,OAAOF,gBAAgB;AACzB","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _index = require("
|
|
8
|
+
var _index = require("../../../index");
|
|
9
9
|
var _getParticiples = _interopRequireDefault(require("../helpers/internal/getParticiples"));
|
|
10
10
|
var _exceptionsParticiplesActive = _interopRequireDefault(require("../config/internal/exceptionsParticiplesActive.js"));
|
|
11
11
|
var _passiveVoiceAuxiliaries = require("../config/internal/passiveVoiceAuxiliaries.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clause.js","names":["_lodash","require","_index","_getParticiples","_interopRequireDefault","_exceptionsParticiplesActive","_passiveVoiceAuxiliaries","e","__esModule","default","indices","values","languageProcessing","getIndicesByWord","getIndicesByWordList","Clause","exceptionsRegex","GermanClause","constructor","clauseText","auxiliaries","_participles","getParticiples","getClauseText","checkParticiples","foundParticiples","filter","participle","hasNounSuffix","includes","exceptionsParticiplesActive","hasHabenSeinException","participleLikeAuxiliaries","setPassive","length","match","participleIndices","habenSeinIndices","map","currentParticiple","index","_default","exports"],"sources":["../../../../../src/languageProcessing/languages/de/values/Clause.js"],"sourcesContent":["import {includes, map} from 'lodash';\nimport {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"Clause.js","names":["_lodash","require","_index","_getParticiples","_interopRequireDefault","_exceptionsParticiplesActive","_passiveVoiceAuxiliaries","e","__esModule","default","indices","values","languageProcessing","getIndicesByWord","getIndicesByWordList","Clause","exceptionsRegex","GermanClause","constructor","clauseText","auxiliaries","_participles","getParticiples","getClauseText","checkParticiples","foundParticiples","filter","participle","hasNounSuffix","includes","exceptionsParticiplesActive","hasHabenSeinException","participleLikeAuxiliaries","setPassive","length","match","participleIndices","habenSeinIndices","map","currentParticiple","index","_default","exports"],"sources":["../../../../../src/languageProcessing/languages/de/values/Clause.js"],"sourcesContent":["import {includes, map} from 'lodash';\nimport {languageProcessing} from '../../../index';\nconst {indices, values} = languageProcessing;\nconst {getIndicesByWord, getIndicesByWordList} = indices;\nconst {Clause} = values;\n\nimport getParticiples from '../helpers/internal/getParticiples';\nimport exceptionsParticiplesActive from '../config/internal/exceptionsParticiplesActive.js';\nimport {participleLike as participleLikeAuxiliaries} from '../config/internal/passiveVoiceAuxiliaries.js';\n\nconst exceptionsRegex = /\\S+(apparat|arbeit|dienst|haft|halt|keit|kraft|not|pflicht|schaft|schrift|tät|wert|zeit)($|[ \\n\\r\\t.,'()\"+-;!?:/»«‹›<>])/gi;\n\n/**\n * Creates a Clause object for the German language.\n */\nclass GermanClause extends Clause {\n /**\n * Constructor.\n *\n * @param {string} clauseText The text of the clause.\n * @param {Array} auxiliaries The auxiliaries.\n *\n * @constructor\n */\n constructor(clauseText, auxiliaries) {\n super(clauseText, auxiliaries);\n this._participles = getParticiples(this.getClauseText());\n this.checkParticiples();\n }\n\n /**\n * Checks if any exceptions are applicable to this participle that would result in the clause not being passive.\n * If no exceptions are found, the clause is passive.\n *\n * @returns {void}\n */\n checkParticiples() {\n const foundParticiples = this.getParticiples().filter(participle => {\n return (\n !this.hasNounSuffix(participle) &&\n !includes(exceptionsParticiplesActive, participle) &&\n !this.hasHabenSeinException(participle) &&\n !includes(participleLikeAuxiliaries, participle)\n );\n });\n\n this.setPassive(foundParticiples.length > 0);\n }\n\n /**\n * Checks whether a found participle ends in a noun suffix.\n * If a word ends in a noun suffix from the exceptionsRegex, it isn't a participle.\n *\n * @param {string} participle The participle to check.\n *\n * @returns {boolean} Returns true if it ends in a noun suffix, otherwise returns false.\n */\n hasNounSuffix(participle) {\n return participle.match(exceptionsRegex) !== null;\n }\n\n /**\n * Checks whether a participle is followed by 'haben' or 'sein'.\n * If a participle is followed by one of these, the clause is not passive.\n *\n * @param {string} participle The participle to check.\n *\n * @returns {boolean} Returns true if it is an exception, otherwise returns false.\n */\n hasHabenSeinException(participle) {\n const participleIndices = getIndicesByWord(participle, this.getClauseText());\n let habenSeinIndices = getIndicesByWordList(['haben', 'sein'], this.getClauseText());\n\n // Don't check further if there is no participle or no haben/sein.\n if (participleIndices.length === 0 || habenSeinIndices.length === 0) {\n return false;\n }\n\n habenSeinIndices = map(habenSeinIndices, 'index');\n const currentParticiple = participleIndices[0];\n return includes(habenSeinIndices, currentParticiple.index + currentParticiple.match.length + 1);\n }\n}\n\nexport default GermanClause;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,4BAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,wBAAA,GAAAL,OAAA;AAA0G,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAN1G,MAAM;EAACG,OAAO;EAAEC;AAAM,CAAC,GAAGC,yBAAkB;AAC5C,MAAM;EAACC,gBAAgB;EAAEC;AAAoB,CAAC,GAAGJ,OAAO;AACxD,MAAM;EAACK;AAAM,CAAC,GAAGJ,MAAM;AAMvB,MAAMK,eAAe,GAAG,4HAA4H;;AAEpJ;AACA;AACA;AACA,MAAMC,YAAY,SAASF,MAAM,CAAC;EAChC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,WAAWA,CAACC,UAAU,EAAEC,WAAW,EAAE;IACnC,KAAK,CAACD,UAAU,EAAEC,WAAW,CAAC;IAC9B,IAAI,CAACC,YAAY,GAAG,IAAAC,uBAAc,EAAC,IAAI,CAACC,aAAa,CAAC,CAAC,CAAC;IACxD,IAAI,CAACC,gBAAg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AK,GAAGD,iBAAiB,CAACJ,KAAK,CAACD,MAAM,GAAG,CAAC,CAAC;EACjG;AACF;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAjC,OAAA,GAEcQ,YAAY","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _firstWordExceptions = _interopRequireDefault(require("./config/firstWordExceptions"));
|
|
9
9
|
var _transitionWords = _interopRequireDefault(require("./config/transitionWords"));
|
|
10
10
|
var _twoPartTransitionWords = _interopRequireDefault(require("./config/twoPartTransitionWords"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Researcher.js","names":["_index","require","_firstWordExceptions","_interopRequireDefault","_transitionWords","_twoPartTransitionWords","_functionWords","_getStemmer","_getClauses","_isPassiveSentence","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","defaultResearches","getFleschReadingScore","Object","assign","config","language","functionWords","passiveConstructionType","transitionWords","twoPartTransitionWords","firstWordExceptions","firstWords","secondWordExceptions","secondWords","helpers","getStemmer","getClauses","isPassiveSentence","exports"],"sources":["../../../../src/languageProcessing/languages/el/Researcher.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"Researcher.js","names":["_index","require","_firstWordExceptions","_interopRequireDefault","_transitionWords","_twoPartTransitionWords","_functionWords","_getStemmer","_getClauses","_isPassiveSentence","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","defaultResearches","getFleschReadingScore","Object","assign","config","language","functionWords","passiveConstructionType","transitionWords","twoPartTransitionWords","firstWordExceptions","firstWords","secondWordExceptions","secondWords","helpers","getStemmer","getClauses","isPassiveSentence","exports"],"sources":["../../../../src/languageProcessing/languages/el/Researcher.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {AbstractResearcher} = languageProcessing;\n\n// All config\nimport firstWordExceptions from './config/firstWordExceptions';\nimport transitionWords from './config/transitionWords';\nimport twoPartTransitionWords from './config/twoPartTransitionWords';\nimport functionWords from './config/functionWords';\n\n// All helpers\nimport getStemmer from './helpers/getStemmer';\nimport getClauses from './helpers/getClauses';\nimport isPassiveSentence from './helpers/isPassiveSentence';\n\n/**\n * The researcher contains all the researches, helpers, data, and config.\n */\nexport default class Researcher extends AbstractResearcher {\n /**\n * Constructor\n * @param {Paper} paper The Paper object that is needed within the researches.\n * @constructor\n */\n constructor(paper) {\n super(paper);\n\n // Deletes researches that are not available for languages that we haven't supported yet.\n delete this.defaultResearches.getFleschReadingScore;\n\n Object.assign(this.config, {\n language: 'el',\n functionWords,\n passiveConstructionType: 'morphologicalAndPeriphrastic',\n transitionWords,\n twoPartTransitionWords,\n firstWordExceptions: firstWordExceptions.firstWords,\n secondWordExceptions: firstWordExceptions.secondWords\n });\n\n Object.assign(this.helpers, {\n getStemmer,\n getClauses,\n isPassiveSentence\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,uBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,cAAA,GAAAH,sBAAA,CAAAF,OAAA;AAGA,IAAAM,WAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,WAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,kBAAA,GAAAN,sBAAA,CAAAF,OAAA;AAA4D,SAAAE,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAX5D,MAAM;EAACG;AAAkB,CAAC,GAAGC,yBAAkB;;AAE/C;;AAMA;;AAKA;AACA;AACA;AACe,MAAMC,UAAU,SAASF,kBAAkB,CAAC;EACzD;AACF;AACA;AACA;AACA;EACEG,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;;IAEZ;IACA,OAAO,IAAI,CAACC,iBAAiB,CAACC,qBAAqB;IAEnDC,MAAM,CAACC,MAAM,CAAC,IAAI,CAACC,MAAM,EAAE;MACzBC,QAAQ,EAAE,IAAI;MACdC,aAAa,EAAbA,sBAAa;MACbC,uBAAuB,EAAE,8BAA8B;MACvDC,eAAe,EAAfA,wBAAe;MACfC,sBAAsB,EAAtBA,+BAAsB;MACtBC,mBAAmB,EAAEA,4BAAmB,CAACC,UAAU;MACnDC,oBAAoB,EAAEF,4BAAmB,CAACG;IAC5C,CAAC,CAAC;IAEFX,MAAM,CAACC,MAAM,CAAC,IAAI,CAACW,OAAO,EAAE;MAC1BC,UAAU,EAAVA,mBAAU;MACVC,UAAU,EAAVA,mBAAU;MACVC,iBAAiB,EAAjBA;IACF,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAAxB,OAAA,GAAAG,UAAA","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getGreekClauses;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _Clause = _interopRequireDefault(require("../values/Clause"));
|
|
9
9
|
var _auxiliaries = _interopRequireDefault(require("../config/internal/auxiliaries.js"));
|
|
10
10
|
var _stopWords = _interopRequireDefault(require("../config/stopWords"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClauses.js","names":["_index","require","_Clause","_interopRequireDefault","_auxiliaries","_stopWords","e","__esModule","default","getClausesSplitOnStopWords","createRegexFromArray","languageProcessing","options","Clause","GreekClause","regexes","auxiliaryRegex","auxiliaries","stopwordRegex","stopWords","getGreekClauses","sentence"],"sources":["../../../../../src/languageProcessing/languages/el/helpers/getClauses.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getClauses.js","names":["_index","require","_Clause","_interopRequireDefault","_auxiliaries","_stopWords","e","__esModule","default","getClausesSplitOnStopWords","createRegexFromArray","languageProcessing","options","Clause","GreekClause","regexes","auxiliaryRegex","auxiliaries","stopwordRegex","stopWords","getGreekClauses","sentence"],"sources":["../../../../../src/languageProcessing/languages/el/helpers/getClauses.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {getClausesSplitOnStopWords, createRegexFromArray} = languageProcessing;\n\nimport GreekClause from '../values/Clause';\nimport auxiliaries from '../config/internal/auxiliaries.js';\nimport stopWords from '../config/stopWords';\n\nconst options = {\n Clause: GreekClause,\n regexes: {\n auxiliaryRegex: createRegexFromArray(auxiliaries),\n stopwordRegex: createRegexFromArray(stopWords)\n }\n};\n\n/**\n * Gets the clauses from a sentence by determining sentence breakers.\n *\n * @param {string} sentence The sentence to split up in clauses.\n *\n * @returns {Array} The array with all clauses that have an auxiliary.\n */\nexport default function getGreekClauses(sentence) {\n return getClausesSplitOnStopWords(sentence, options);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAF,sBAAA,CAAAF,OAAA;AAA4C,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAJ5C,MAAM;EAACG,0BAA0B;EAAEC;AAAoB,CAAC,GAAGC,yBAAkB;AAM7E,MAAMC,OAAO,GAAG;EACdC,MAAM,EAAEC,eAAW;EACnBC,OAAO,EAAE;IACPC,cAAc,EAAEN,oBAAoB,CAACO,oBAAW,CAAC;IACjDC,aAAa,EAAER,oBAAoB,CAACS,kBAAS;EAC/C;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,eAAeA,CAACC,QAAQ,EAAE;EAChD,OAAOZ,0BAA0B,CAACY,QAAQ,EAAET,OAAO,CAAC;AACtD","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = getStemmer;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _index = require("
|
|
8
|
+
var _index = require("../../../index");
|
|
9
9
|
var _stem = _interopRequireDefault(require("./internal/stem"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_stem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","stem"],"sources":["../../../../../src/languageProcessing/languages/el/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_stem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","stem"],"sources":["../../../../../src/languageProcessing/languages/el/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '../../../index';\nimport stem from './internal/stem';\nconst {baseStemmer} = languageProcessing;\n\n/**\n * Returns the stemmer for a researcher.\n *\n * @param {Researcher} researcher The researcher.\n *\n * @returns {Function} The stemmer.\n */\nexport default function getStemmer(researcher) {\n const morphologyData = get(researcher.getData('morphology'), 'el', false);\n\n if (morphologyData) {\n return word => stem(word, morphologyData);\n }\n\n return baseStemmer;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAmC,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AACnC,MAAM;EAACG;AAAW,CAAC,GAAGC,yBAAkB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,UAAUA,CAACC,UAAU,EAAE;EAC7C,MAAMC,cAAc,GAAG,IAAAC,WAAG,EAACF,UAAU,CAACG,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC;EAEzE,IAAIF,cAAc,EAAE;IAClB,OAAOG,IAAI,IAAI,IAAAC,aAAI,EAACD,IAAI,EAAEH,cAAc,CAAC;EAC3C;EAEA,OAAOJ,WAAW;AACpB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getParticiples.js","names":["_index","require","getWords","languageProcessing","passiveParticipleEndings","_default","clauseText","words","filter","word","RegExp","test"],"sources":["../../../../../../src/languageProcessing/languages/el/helpers/internal/getParticiples.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getParticiples.js","names":["_index","require","getWords","languageProcessing","passiveParticipleEndings","_default","clauseText","words","filter","word","RegExp","test"],"sources":["../../../../../../src/languageProcessing/languages/el/helpers/internal/getParticiples.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {getWords} = languageProcessing;\n\nconst passiveParticipleEndings =\n '(ούμενους|ημένους|ούμενος|ούμενου|ούμενον|ούμενης|ούμενοι|ούμενων|ούμενες|μένους|' +\n 'ημένος|ημένου|ημένον|ημένοι|ημένων|ημένης|ημένες|ούμενη|ούμενο|ούμενα|μένος|μένου|μένον|μένοι|μένης|μένες|' +\n 'μένων|ημένη|ημένο|ημένα|μένη|μένο|μένα)$';\n\n/**\n * Creates an array of participles found in a clause.\n *\n * @param {string} clauseText The clause to finds participles in.\n *\n * @returns {Array} The array with the participles found.\n */\nexport default function(clauseText) {\n const words = getWords(clauseText);\n\n return words.filter(word => new RegExp(passiveParticipleEndings).test(word));\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,MAAM;EAACC;AAAQ,CAAC,GAAGC,yBAAkB;AAErC,MAAMC,wBAAwB,GAC5B,mFAAmF,GACnF,4GAA4G,GAC5G,0CAA0C;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAAC,SAASC,UAAU,EAAE;EAClC,MAAMC,KAAK,GAAGL,QAAQ,CAACI,UAAU,CAAC;EAElC,OAAOC,KAAK,CAACC,MAAM,CAACC,IAAI,IAAI,IAAIC,MAAM,CAACN,wBAAwB,CAAC,CAACO,IAAI,CAACF,IAAI,CAAC,CAAC;AAC9E","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = isPassiveSentence;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _nonPassiveVerbStems = _interopRequireDefault(require("../config/internal/nonPassiveVerbStems"));
|
|
9
9
|
var _morphologicalPassiveSuffixes = require("../config/internal/morphologicalPassiveSuffixes.js");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPassiveSentence.js","names":["_index","require","_nonPassiveVerbStems","_interopRequireDefault","_morphologicalPassiveSuffixes","e","__esModule","default","getWords","directPrecedenceException","languageProcessing","directPrecedenceExceptionList","isPassiveSentence","sentence","words","word","suffix","passiveSuffixes","endsWith","length","stem","slice","test","nonPassiveVerbStems","includes"],"sources":["../../../../../src/languageProcessing/languages/el/helpers/isPassiveSentence.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"isPassiveSentence.js","names":["_index","require","_nonPassiveVerbStems","_interopRequireDefault","_morphologicalPassiveSuffixes","e","__esModule","default","getWords","directPrecedenceException","languageProcessing","directPrecedenceExceptionList","isPassiveSentence","sentence","words","word","suffix","passiveSuffixes","endsWith","length","stem","slice","test","nonPassiveVerbStems","includes"],"sources":["../../../../../src/languageProcessing/languages/el/helpers/isPassiveSentence.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {getWords, directPrecedenceException} = languageProcessing;\n\nimport nonPassiveVerbStems from '../config/internal/nonPassiveVerbStems';\nimport {passiveSuffixes} from '../config/internal/morphologicalPassiveSuffixes.js';\n\nconst directPrecedenceExceptionList = ['να'];\n\n/**\n * Checks the passed sentence to see if it contains Greek passive verb-forms.\n *\n * @param {string} sentence The sentence to match against.\n *\n * @returns {Boolean} Whether the sentence is passive or not.\n */\nexport default function isPassiveSentence(sentence) {\n const words = getWords(sentence);\n\n for (const word of words) {\n for (const suffix of passiveSuffixes) {\n if (word.endsWith(suffix) && word.length > 4) {\n // Get the stem of the word.\n const stem = word.slice(0, -suffix.length);\n /*\n * Return true if the word ends with one of the passive suffixes, if the word is more than 4 characters long\n * And if the word stem is not in the non-passive exception list.\n *\n * Passive infinitive with -θεί/-τεί is not a valid passive if it's directly preceded by \"να\".\n */\n return /^(θεί|τεί)$/.test(suffix)\n ? !nonPassiveVerbStems.includes(stem) &&\n !directPrecedenceException(sentence, word, directPrecedenceExceptionList)\n : !nonPassiveVerbStems.includes(stem);\n }\n }\n }\n return false;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,6BAAA,GAAAH,OAAA;AAAmF,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAHnF,MAAM;EAACG,QAAQ;EAAEC;AAAyB,CAAC,GAAGC,yBAAkB;AAKhE,MAAMC,6BAA6B,GAAG,CAAC,IAAI,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,iBAAiBA,CAACC,QAAQ,EAAE;EAClD,MAAMC,KAAK,GAAGN,QAAQ,CAACK,QAAQ,CAAC;EAEhC,KAAK,MAAME,IAAI,IAAID,KAAK,EAAE;IACxB,KAAK,MAAME,MAAM,IAAIC,6CAAe,EAAE;MACpC,IAAIF,IAAI,CAACG,QAAQ,CAACF,MAAM,CAAC,IAAID,IAAI,CAACI,MAAM,GAAG,CAAC,EAAE;QAC5C;QACA,MAAMC,IAAI,GAAGL,IAAI,CAACM,KAAK,CAAC,CAAC,EAAE,CAACL,MAAM,CAACG,MAAM,CAAC;QAC1C;AACR;AACA;AACA;AACA;AACA;QACQ,OAAO,aAAa,CAACG,IAAI,CAACN,MAAM,CAAC,GAC7B,CAACO,4BAAmB,CAACC,QAAQ,CAACJ,IAAI,CAAC,IACjC,CAACX,yBAAyB,CAACI,QAAQ,EAAEE,IAAI,EAAEJ,6BAA6B,CAAC,GAC3E,CAACY,4BAAmB,CAACC,QAAQ,CAACJ,IAAI,CAAC;MACzC;IACF;EACF;EACA,OAAO,KAAK;AACd","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _getParticiples = _interopRequireDefault(require("../helpers/internal/getParticiples"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clause.js","names":["_index","require","_getParticiples","_interopRequireDefault","e","__esModule","default","values","languageProcessing","Clause","GreekClause","constructor","clauseText","auxiliaries","_participles","getParticiples","getClauseText","checkParticiples","participles","setPassive","length","_default","exports"],"sources":["../../../../../src/languageProcessing/languages/el/values/Clause.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"Clause.js","names":["_index","require","_getParticiples","_interopRequireDefault","e","__esModule","default","values","languageProcessing","Clause","GreekClause","constructor","clauseText","auxiliaries","_participles","getParticiples","getClauseText","checkParticiples","participles","setPassive","length","_default","exports"],"sources":["../../../../../src/languageProcessing/languages/el/values/Clause.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {values} = languageProcessing;\nconst {Clause} = values;\nimport getParticiples from '../helpers/internal/getParticiples';\n\n/**\n * Creates a Clause object for the Greek language.\n */\nclass GreekClause extends Clause {\n /**\n * Constructor.\n *\n * @param {string} clauseText The text of the clause.\n * @param {Array} auxiliaries The auxiliaries.\n *\n * @constructor\n */\n constructor(clauseText, auxiliaries) {\n super(clauseText, auxiliaries);\n this._participles = getParticiples(this.getClauseText());\n this.checkParticiples();\n }\n\n /**\n * Sets the passiveness of a clause based on whether the matched participle is a valid one.\n * We only process clauses that have an auxiliary in this check.\n *\n * @returns {void}\n */\n checkParticiples() {\n const participles = this.getParticiples();\n\n this.setPassive(participles.length > 0);\n }\n}\n\nexport default GreekClause;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAgE,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFhE,MAAM;EAACG;AAAM,CAAC,GAAGC,yBAAkB;AACnC,MAAM;EAACC;AAAM,CAAC,GAAGF,MAAM;AAGvB;AACA;AACA;AACA,MAAMG,WAAW,SAASD,MAAM,CAAC;EAC/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,WAAWA,CAACC,UAAU,EAAEC,WAAW,EAAE;IACnC,KAAK,CAACD,UAAU,EAAEC,WAAW,CAAC;IAC9B,IAAI,CAACC,YAAY,GAAG,IAAAC,uBAAc,EAAC,IAAI,CAACC,aAAa,CAAC,CAAC,CAAC;IACxD,IAAI,CAACC,gBAAgB,CAAC,CAAC;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEA,gBAAgBA,CAAA,EAAG;IACjB,MAAMC,WAAW,GAAG,IAAI,CAACH,cAAc,CAAC,CAAC;IAEzC,IAAI,CAACI,UAAU,CAACD,WAAW,CAACE,MAAM,GAAG,CAAC,CAAC;EACzC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhB,OAAA,GAEcI,WAAW","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _firstWordExceptions = _interopRequireDefault(require("./config/firstWordExceptions"));
|
|
9
9
|
var _functionWords = require("./config/functionWords");
|
|
10
10
|
var _stopWords = _interopRequireDefault(require("./config/stopWords"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Researcher.js","names":["_index","require","_firstWordExceptions","_interopRequireDefault","_functionWords","_stopWords","_transitionWords","_twoPartTransitionWords","_syllables","_getClauses","_getStemmer","_calculateFleschReadingScore","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","Object","assign","config","language","passiveConstructionType","firstWordExceptions","functionWords","stopWords","transitionWords","twoPartTransitionWords","syllables","helpers","getClauses","getStemmer","fleschReadingScore","exports"],"sources":["../../../../src/languageProcessing/languages/en/Researcher.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"Researcher.js","names":["_index","require","_firstWordExceptions","_interopRequireDefault","_functionWords","_stopWords","_transitionWords","_twoPartTransitionWords","_syllables","_getClauses","_getStemmer","_calculateFleschReadingScore","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","Object","assign","config","language","passiveConstructionType","firstWordExceptions","functionWords","stopWords","transitionWords","twoPartTransitionWords","syllables","helpers","getClauses","getStemmer","fleschReadingScore","exports"],"sources":["../../../../src/languageProcessing/languages/en/Researcher.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {AbstractResearcher} = languageProcessing;\n\n// All config\nimport firstWordExceptions from './config/firstWordExceptions';\nimport {all as functionWords} from './config/functionWords';\nimport stopWords from './config/stopWords';\nimport transitionWords from './config/transitionWords';\nimport twoPartTransitionWords from './config/twoPartTransitionWords';\nimport syllables from './config/syllables.json';\n\n// All helpers\nimport getClauses from './helpers/getClauses';\nimport getStemmer from './helpers/getStemmer';\nimport fleschReadingScore from './helpers/calculateFleschReadingScore';\n\n/**\n * The researcher contains all the researches, helpers, data, and config.\n */\nexport default class Researcher extends AbstractResearcher {\n /**\n * Constructor\n * @param {Paper} paper The Paper object that is needed within the researches.\n * @constructor\n */\n constructor(paper) {\n super(paper);\n\n Object.assign(this.config, {\n language: 'en',\n passiveConstructionType: 'periphrastic',\n firstWordExceptions,\n functionWords,\n stopWords,\n transitionWords,\n twoPartTransitionWords,\n syllables\n });\n\n Object.assign(this.helpers, {\n getClauses,\n getStemmer,\n fleschReadingScore\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,gBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,uBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,UAAA,GAAAL,sBAAA,CAAAF,OAAA;AAGA,IAAAQ,WAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,WAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,4BAAA,GAAAR,sBAAA,CAAAF,OAAA;AAAuE,SAAAE,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAbvE,MAAM;EAACG;AAAkB,CAAC,GAAGC,yBAAkB;;AAE/C;;AAQA;;AAKA;AACA;AACA;AACe,MAAMC,UAAU,SAASF,kBAAkB,CAAC;EACzD;AACF;AACA;AACA;AACA;EACEG,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZC,MAAM,CAACC,MAAM,CAAC,IAAI,CAACC,MAAM,EAAE;MACzBC,QAAQ,EAAE,IAAI;MACdC,uBAAuB,EAAE,cAAc;MACvCC,mBAAmB,EAAnBA,4BAAmB;MACnBC,aAAa,EAAbA,kBAAa;MACbC,SAAS,EAATA,kBAAS;MACTC,eAAe,EAAfA,wBAAe;MACfC,sBAAsB,EAAtBA,+BAAsB;MACtBC,SAAS,EAATA;IACF,CAAC,CAAC;IAEFV,MAAM,CAACC,MAAM,CAAC,IAAI,CAACU,OAAO,EAAE;MAC1BC,UAAU,EAAVA,mBAAU;MACVC,UAAU,EAAVA,mBAAU;MACVC,kBAAkB,EAAlBA;IACF,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAArB,OAAA,GAAAG,UAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateFleschReadingScore.js","names":["_index","require","formatNumber","helpers","calculateScore","statistics","score","averageWordsPerSentence","numberOfSyllables","numberOfWords"],"sources":["../../../../../src/languageProcessing/languages/en/helpers/calculateFleschReadingScore.js"],"sourcesContent":["import {helpers} from '
|
|
1
|
+
{"version":3,"file":"calculateFleschReadingScore.js","names":["_index","require","formatNumber","helpers","calculateScore","statistics","score","averageWordsPerSentence","numberOfSyllables","numberOfWords"],"sources":["../../../../../src/languageProcessing/languages/en/helpers/calculateFleschReadingScore.js"],"sourcesContent":["import {helpers} from '../../../index';\nconst {formatNumber} = helpers;\n\n/**\n * Returns the Flesch reading score for English.\n *\n * @param {Object} statistics The Flesch reading statistics.\n *\n * @returns {number} The Flesch reading score for English.\n */\nexport default function calculateScore(statistics) {\n const score =\n 206.835 -\n 1.015 * statistics.averageWordsPerSentence -\n 84.6 * (statistics.numberOfSyllables / statistics.numberOfWords);\n\n return formatNumber(score);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,MAAM;EAACC;AAAY,CAAC,GAAGC,cAAO;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAACC,UAAU,EAAE;EACjD,MAAMC,KAAK,GACT,OAAO,GACP,KAAK,GAAGD,UAAU,CAACE,uBAAuB,GAC1C,IAAI,IAAIF,UAAU,CAACG,iBAAiB,GAAGH,UAAU,CAACI,aAAa,CAAC;EAElE,OAAOP,YAAY,CAACI,KAAK,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getEnglishClauses;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _Clause = _interopRequireDefault(require("../values/Clause"));
|
|
9
9
|
var _passiveVoiceAuxiliaries = _interopRequireDefault(require("../config/internal/passiveVoiceAuxiliaries.js"));
|
|
10
10
|
var _stopWords = _interopRequireDefault(require("../config/stopWords.js"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClauses.js","names":["_index","require","_Clause","_interopRequireDefault","_passiveVoiceAuxiliaries","_stopWords","_lodash","_stripSpaces","_indices","e","__esModule","default","createRegexFromArray","getClauses","languageProcessing","options","Clause","stopwords","auxiliaries","ingExclusions","regexes","auxiliaryRegex","stopCharacterRegex","verbEndingInIngRegex","otherStopWordIndices","getVerbsEndingInIngIndices","sentence","matches","match","filter","includes","stripSpaces","getIndicesOfList","getEnglishClauses"],"sources":["../../../../../src/languageProcessing/languages/en/helpers/getClauses.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getClauses.js","names":["_index","require","_Clause","_interopRequireDefault","_passiveVoiceAuxiliaries","_stopWords","_lodash","_stripSpaces","_indices","e","__esModule","default","createRegexFromArray","getClauses","languageProcessing","options","Clause","stopwords","auxiliaries","ingExclusions","regexes","auxiliaryRegex","stopCharacterRegex","verbEndingInIngRegex","otherStopWordIndices","getVerbsEndingInIngIndices","sentence","matches","match","filter","includes","stripSpaces","getIndicesOfList","getEnglishClauses"],"sources":["../../../../../src/languageProcessing/languages/en/helpers/getClauses.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {createRegexFromArray, getClauses} = languageProcessing;\n\nimport Clause from '../values/Clause';\nimport auxiliaries from '../config/internal/passiveVoiceAuxiliaries.js';\nimport stopwords from '../config/stopWords.js';\nimport {includes} from 'lodash';\nimport stripSpaces from '../../../helpers/sanitize/stripSpaces';\nimport {getIndicesByWordList as getIndicesOfList} from '../../../helpers/word/indices';\n\nconst options = {\n Clause,\n stopwords,\n auxiliaries: auxiliaries,\n ingExclusions: ['king', 'cling', 'ring', 'being', 'thing', 'something', 'anything'],\n regexes: {\n auxiliaryRegex: createRegexFromArray(auxiliaries),\n stopCharacterRegex: /([:,]|('ll)|('ve))(?=[ \\n\\r\\t'\"+\\-»«‹›<>])/gi,\n verbEndingInIngRegex: /\\w+ing(?=$|[ \\n\\r\\t.,'()\"+\\-;!?:/»«‹›<>])/gi\n },\n otherStopWordIndices: []\n};\n\n/**\n * Gets active verbs (ending in ing) to determine sentence breakers in English.\n *\n * @param {string} sentence The sentence to get the active verbs from.\n *\n * @returns {Array} The array with valid matches.\n */\nconst getVerbsEndingInIngIndices = function(sentence) {\n // Matches the sentences with words ending in ing.\n let matches = sentence.match(options.regexes.verbEndingInIngRegex) || [];\n // Filters out words ending in -ing that aren't verbs.\n matches = matches.filter(match => !includes(options.ingExclusions, stripSpaces(match)));\n return getIndicesOfList(matches, sentence);\n};\n\n/**\n * Gets the clauses from a sentence by determining sentence breakers.\n *\n * @param {string} sentence The sentence to split up in clauses.\n *\n * @returns {Array} The array with all clauses that have an auxiliary.\n */\nexport default function getEnglishClauses(sentence) {\n options.otherStopWordIndices = getVerbsEndingInIngIndices(sentence);\n return getClauses(sentence, options);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,wBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAAuF,SAAAE,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAPvF,MAAM;EAACG,oBAAoB;EAAEC;AAAU,CAAC,GAAGC,yBAAkB;AAS7D,MAAMC,OAAO,GAAG;EACdC,MAAM,EAANA,eAAM;EACNC,SAAS,EAATA,kBAAS;EACTC,WAAW,EAAEA,gCAAW;EACxBC,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC;EACnFC,OAAO,EAAE;IACPC,cAAc,EAAET,oBAAoB,CAACM,gCAAW,CAAC;IACjDI,kBAAkB,EAAE,8CAA8C;IAClEC,oBAAoB,EAAE;EACxB,CAAC;EACDC,oBAAoB,EAAE;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAG,SAAAA,CAASC,QAAQ,EAAE;EACpD;EACA,IAAIC,OAAO,GAAGD,QAAQ,CAACE,KAAK,CAACb,OAAO,CAACK,OAAO,CAACG,oBAAoB,CAAC,IAAI,EAAE;EACxE;EACAI,OAAO,GAAGA,OAAO,CAACE,MAAM,CAACD,KAAK,IAAI,CAAC,IAAAE,gBAAQ,EAACf,OAAO,CAACI,aAAa,EAAE,IAAAY,oBAAW,EAACH,KAAK,CAAC,CAAC,CAAC;EACvF,OAAO,IAAAI,6BAAgB,EAACL,OAAO,EAAED,QAAQ,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASO,iBAAiBA,CAACP,QAAQ,EAAE;EAClDX,OAAO,CAACS,oBAAoB,GAAGC,0BAA0B,CAACC,QAAQ,CAAC;EACnE,OAAOb,UAAU,CAACa,QAAQ,EAAEX,OAAO,CAAC;AACtC","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = getStemmer;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _index = require("
|
|
8
|
+
var _index = require("../../../index");
|
|
9
9
|
var _determineStem = _interopRequireDefault(require("./internal/determineStem"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_determineStem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","determineStem"],"sources":["../../../../../src/languageProcessing/languages/en/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_determineStem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","determineStem"],"sources":["../../../../../src/languageProcessing/languages/en/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '../../../index';\nconst {baseStemmer} = languageProcessing;\n\nimport determineStem from './internal/determineStem';\n\n/**\n * Returns the stemmer for a researcher.\n *\n * @param {Researcher} researcher The researcher.\n *\n * @returns {Function} The stemmer.\n */\nexport default function getStemmer(researcher) {\n const morphologyData = get(researcher.getData('morphology'), 'en', false);\n\n if (morphologyData) {\n return word => determineStem(word, morphologyData);\n }\n\n return baseStemmer;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAqD,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFrD,MAAM;EAACG;AAAW,CAAC,GAAGC,yBAAkB;AAIxC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,UAAUA,CAACC,UAAU,EAAE;EAC7C,MAAMC,cAAc,GAAG,IAAAC,WAAG,EAACF,UAAU,CAACG,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC;EAEzE,IAAIF,cAAc,EAAE;IAClB,OAAOG,IAAI,IAAI,IAAAC,sBAAa,EAACD,IAAI,EAAEH,cAAc,CAAC;EACpD;EAEA,OAAOJ,WAAW;AACpB","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ exports.determineRegularStem = determineRegularStem;
|
|
|
10
10
|
exports.determineStem = determineStem;
|
|
11
11
|
exports.findShortestAndAlphabeticallyFirst = findShortestAndAlphabeticallyFirst;
|
|
12
12
|
var _lodash = require("lodash");
|
|
13
|
-
var _index = require("
|
|
13
|
+
var _index = require("../../../index");
|
|
14
14
|
var _getAdjectiveStem = _interopRequireDefault(require("./getAdjectiveStem"));
|
|
15
15
|
var _getVerbStem = require("./getVerbStem.js");
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"determineStem.js","names":["_lodash","require","_index","_getAdjectiveStem","_interopRequireDefault","_getVerbStem","e","__esModule","default","buildFormRule","createRulesFromArrays","languageProcessing","findShortestAndAlphabeticallyFirst","array","strings","flatten","result","pop","forEach","str","lengthDifference","length","localeCompare","determineIrregularStem","word","irregulars","paradigm","includes","determineIrregularVerbStem","verbMorphology","paradigmIfIrregularVerb","getIrregularVerbParadigm","irregularVerbs","regexVerb","verbPrefixes","isUndefined","determineRegularStem","morphologyData","verbs","baseIfPluralNoun","nouns","regexNoun","singularize","endsWithIng","ingFormToInfinitive","regexAdjective","adjectives","baseIfIcally","icallyToBase","possibleRegularBases","baseIfVerb","getInfinitive","infinitive","push","stopAdjectives","multiSyllableAdjWithSuffixes","multiSyllableAdjectives","list","baseIfAdjective","getAdjectiveStem","base","determineStem","nounMorphology","baseIfPossessive","possessiveToBase","stem","irregular","irregularNouns","irregularAdjectives","_default","exports"],"sources":["../../../../../../src/languageProcessing/languages/en/helpers/internal/determineStem.js"],"sourcesContent":["import {isUndefined, flatten} from 'lodash';\nimport {languageProcessing} from '@axyseo/index';\nconst {buildFormRule, createRulesFromArrays} = languageProcessing;\n\nimport getAdjectiveStem from './getAdjectiveStem';\nimport {\n getInfinitive,\n checkIrregulars as getIrregularVerbParadigm,\n endsWithIng\n} from './getVerbStem.js';\n\n/**\n * Gets the shortest of the alphabetically ordered strings from an array.\n *\n * @param {string[]} array The array of strings.\n *\n * @returns {string|undefined} The shortest of the alphabetically ordered strings from the input array;\n * undefined if the input array is empty.\n */\nexport function findShortestAndAlphabeticallyFirst(array) {\n const strings = flatten(array);\n let result = strings.pop();\n\n strings.forEach(str => {\n const lengthDifference = str.length - result.length;\n if (lengthDifference === 0) {\n if (str.localeCompare(result) < 0) {\n result = str;\n }\n } else if (lengthDifference < 0) {\n result = str;\n }\n });\n\n return result;\n}\n\n/**\n * Checks if the input word occurs in the list of exceptions and if so returns the first form of the paradigm, which is\n * always the base.\n *\n * @param {string}\t\tword\t\tThe word for which to determine its base.\n * @param {string[]}\tirregulars\tAn array of irregular nouns and adjectives.\n *\n * @returns {string|null} The base form of the irregular word; null if no irregular stem was found.\n */\nexport function determineIrregularStem(word, irregulars) {\n for (const paradigm of irregulars) {\n if (paradigm.includes(word)) {\n return paradigm[0];\n }\n }\n return null;\n}\n\n/**\n * Checks if the input word occurs in the list of exception verbs and if so returns the first form\n * of the paradigm, which is always the base. Contrary to nouns and adjectives, irregular verbs can have different prefixes\n * which are not included in the list of exceptions and have to be processed separately.\n *\n * @param {string}\tword The word for which to determine its base.\n * @param {Object}\tverbMorphology Regexes and irregulars for verb morphology, False if verb rules should not be applied.\n *\n * @returns {string|null} The base form of the irregular word; null if no irregular stem was found.\n */\nexport function determineIrregularVerbStem(word, verbMorphology) {\n const paradigmIfIrregularVerb = getIrregularVerbParadigm(\n word,\n verbMorphology.irregularVerbs,\n verbMorphology.regexVerb.verbPrefixes\n );\n if (!isUndefined(paradigmIfIrregularVerb)) {\n return paradigmIfIrregularVerb[0];\n }\n return null;\n}\n\n/**\n * Gets possible stems as a regular noun, adjective and verb.\n *\n * @param {string} word The word for which to determine its base.\n * @param {Object} morphologyData The morphology data for the language.\n *\n * @returns {string} The shortest and the alphabetically-first of possible noun-like, verb-like and adjective-like bases.\n */\nexport function determineRegularStem(word, morphologyData) {\n // Try to singularize as a noun.\n const regexVerb = morphologyData.verbs.regexVerb;\n const baseIfPluralNoun = buildFormRule(\n word,\n createRulesFromArrays(morphologyData.nouns.regexNoun.singularize)\n );\n if (!isUndefined(baseIfPluralNoun)) {\n // Bring ing-nouns to base forms (\"blessings\" -> \"bless\").\n if (endsWithIng(baseIfPluralNoun)) {\n return buildFormRule(baseIfPluralNoun, createRulesFromArrays(regexVerb.ingFormToInfinitive));\n }\n return baseIfPluralNoun;\n }\n\n // Check if the word ends with \"ic\", \"ical\" or \"ically\". Return the \"ical\" form for consistency.\n const regexAdjective = morphologyData.adjectives.regexAdjective;\n const baseIfIcally = buildFormRule(word, createRulesFromArrays(regexAdjective.icallyToBase));\n if (!isUndefined(baseIfIcally)) {\n return baseIfIcally;\n }\n\n // No more quick guesses, we have to determine a verbal infinitive and an adjectival base.\n const possibleRegularBases = [];\n\n // Verbal infinitive.\n const baseIfVerb = getInfinitive(word, regexVerb).infinitive;\n\n possibleRegularBases.push(baseIfVerb);\n\n // Adjectival base.\n const stopAdjectives = morphologyData.adjectives.stopAdjectives;\n /*\n\t The following list of words are the stem of adjectives that have two syllables or more that receive -er and -est in their comparative and superlative forms, e.g 'shallow'.\n\t Please note that if the adjective ends in -y and -e, the ending is removed, e.g. 'acute' -> 'acut'.\n\t The list is not exhaustive and can be expanded if needed. Oxford dictionary was used to check if the forms indeed exist, e.g. \"acuter\".\n\t */\n const multiSyllableAdjWithSuffixes = morphologyData.adjectives.multiSyllableAdjectives.list;\n\n const baseIfAdjective = getAdjectiveStem(\n word,\n regexAdjective,\n stopAdjectives,\n multiSyllableAdjWithSuffixes\n ).base;\n possibleRegularBases.push(baseIfAdjective);\n\n return findShortestAndAlphabeticallyFirst(possibleRegularBases);\n}\n\n/**\n * Returns the stem of the input word using the morphologyData (language-specific).\n *\n * @param {string} word The word to get the stem for.\n * @param {Object} morphologyData The available morphology data per language (false if unavailable).\n *\n * @returns {string} Stemmed (or base) form of the word.\n */\nexport function determineStem(word, morphologyData) {\n const nounMorphology = morphologyData.nouns;\n\n const baseIfPossessive = buildFormRule(\n word,\n createRulesFromArrays(nounMorphology.regexNoun.possessiveToBase)\n );\n\n let stem;\n let irregular;\n\n // Determine if this is an irregular noun, adjective or verb.\n if (isUndefined(baseIfPossessive)) {\n stem = word;\n // Word can be a noun, adjective or verb.\n irregular =\n determineIrregularStem(word, nounMorphology.irregularNouns) ||\n determineIrregularStem(word, morphologyData.adjectives.irregularAdjectives) ||\n determineIrregularVerbStem(word, morphologyData.verbs);\n } else {\n stem = baseIfPossessive;\n // The word is a possessive, it can only be a noun or an ing-noun;\n irregular = determineIrregularStem(baseIfPossessive, nounMorphology.irregularNouns);\n }\n\n if (irregular) {\n // Found the stem of an irregular word! Return it.\n return irregular;\n }\n\n // Treat the word as a regular noun, adjective or verb.\n return determineRegularStem(stem, morphologyData);\n}\n\nexport default determineStem;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAI0B,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAP1B,MAAM;EAACG,aAAa;EAAEC;AAAqB,CAAC,GAAGC,yBAAkB;AASjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kCAAkCA,CAACC,KAAK,EAAE;EACxD,MAAMC,OAAO,GAAG,IAAAC,eAAO,EAACF,KAAK,CAAC;EAC9B,IAAIG,MAAM,GAAGF,OAAO,CAACG,GAAG,CAAC,CAAC;EAE1BH,OAAO,CAACI,OAAO,CAACC,GAAG,IAAI;IACrB,MAAMC,gBAAgB,GAAGD,GAAG,CAACE,MAAM,GAAGL,MAAM,CAACK,MAAM;IACnD,IAAID,gBAAgB,KAAK,CAAC,EAAE;MAC1B,IAAID,GAAG,CAACG,aAAa,CAACN,MAAM,CAAC,GAAG,CAAC,EAAE;QACjCA,MAAM,GAAGG,GAAG;MACd;IACF,CAAC,MAAM,IAAIC,gBAAgB,GAAG,CAAC,EAAE;MAC/BJ,MAAM,GAAGG,GAAG;IACd;EACF,CAAC,CAAC;EAEF,OAAOH,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,sBAAsBA,CAACC,IAAI,EAAEC,UAAU,EAAE;EACvD,KAAK,MAAMC,QAAQ,IAAID,UAAU,EAAE;IACjC,IAAIC,QAAQ,CAACC,QAAQ,CAACH,IAAI,CAAC,EAAE;MAC3B,OAAOE,QAAQ,CAAC,CAAC,CAAC;IACpB;EACF;EACA,OAAO,IAAI;AACb;;AAEA;AAC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EA;EACA,OAAO9B,oBAAoB,CAAC6B,IAAI,EAAE5B,cAAc,CAAC;AACnD;AAAC,IAAAgC,QAAA,GAAAC,OAAA,CAAA9D,OAAA,GAEcqD,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"determineStem.js","names":["_lodash","require","_index","_getAdjectiveStem","_interopRequireDefault","_getVerbStem","e","__esModule","default","buildFormRule","createRulesFromArrays","languageProcessing","findShortestAndAlphabeticallyFirst","array","strings","flatten","result","pop","forEach","str","lengthDifference","length","localeCompare","determineIrregularStem","word","irregulars","paradigm","includes","determineIrregularVerbStem","verbMorphology","paradigmIfIrregularVerb","getIrregularVerbParadigm","irregularVerbs","regexVerb","verbPrefixes","isUndefined","determineRegularStem","morphologyData","verbs","baseIfPluralNoun","nouns","regexNoun","singularize","endsWithIng","ingFormToInfinitive","regexAdjective","adjectives","baseIfIcally","icallyToBase","possibleRegularBases","baseIfVerb","getInfinitive","infinitive","push","stopAdjectives","multiSyllableAdjWithSuffixes","multiSyllableAdjectives","list","baseIfAdjective","getAdjectiveStem","base","determineStem","nounMorphology","baseIfPossessive","possessiveToBase","stem","irregular","irregularNouns","irregularAdjectives","_default","exports"],"sources":["../../../../../../src/languageProcessing/languages/en/helpers/internal/determineStem.js"],"sourcesContent":["import {isUndefined, flatten} from 'lodash';\nimport {languageProcessing} from '../../../index';\nconst {buildFormRule, createRulesFromArrays} = languageProcessing;\n\nimport getAdjectiveStem from './getAdjectiveStem';\nimport {\n getInfinitive,\n checkIrregulars as getIrregularVerbParadigm,\n endsWithIng\n} from './getVerbStem.js';\n\n/**\n * Gets the shortest of the alphabetically ordered strings from an array.\n *\n * @param {string[]} array The array of strings.\n *\n * @returns {string|undefined} The shortest of the alphabetically ordered strings from the input array;\n * undefined if the input array is empty.\n */\nexport function findShortestAndAlphabeticallyFirst(array) {\n const strings = flatten(array);\n let result = strings.pop();\n\n strings.forEach(str => {\n const lengthDifference = str.length - result.length;\n if (lengthDifference === 0) {\n if (str.localeCompare(result) < 0) {\n result = str;\n }\n } else if (lengthDifference < 0) {\n result = str;\n }\n });\n\n return result;\n}\n\n/**\n * Checks if the input word occurs in the list of exceptions and if so returns the first form of the paradigm, which is\n * always the base.\n *\n * @param {string}\t\tword\t\tThe word for which to determine its base.\n * @param {string[]}\tirregulars\tAn array of irregular nouns and adjectives.\n *\n * @returns {string|null} The base form of the irregular word; null if no irregular stem was found.\n */\nexport function determineIrregularStem(word, irregulars) {\n for (const paradigm of irregulars) {\n if (paradigm.includes(word)) {\n return paradigm[0];\n }\n }\n return null;\n}\n\n/**\n * Checks if the input word occurs in the list of exception verbs and if so returns the first form\n * of the paradigm, which is always the base. Contrary to nouns and adjectives, irregular verbs can have different prefixes\n * which are not included in the list of exceptions and have to be processed separately.\n *\n * @param {string}\tword The word for which to determine its base.\n * @param {Object}\tverbMorphology Regexes and irregulars for verb morphology, False if verb rules should not be applied.\n *\n * @returns {string|null} The base form of the irregular word; null if no irregular stem was found.\n */\nexport function determineIrregularVerbStem(word, verbMorphology) {\n const paradigmIfIrregularVerb = getIrregularVerbParadigm(\n word,\n verbMorphology.irregularVerbs,\n verbMorphology.regexVerb.verbPrefixes\n );\n if (!isUndefined(paradigmIfIrregularVerb)) {\n return paradigmIfIrregularVerb[0];\n }\n return null;\n}\n\n/**\n * Gets possible stems as a regular noun, adjective and verb.\n *\n * @param {string} word The word for which to determine its base.\n * @param {Object} morphologyData The morphology data for the language.\n *\n * @returns {string} The shortest and the alphabetically-first of possible noun-like, verb-like and adjective-like bases.\n */\nexport function determineRegularStem(word, morphologyData) {\n // Try to singularize as a noun.\n const regexVerb = morphologyData.verbs.regexVerb;\n const baseIfPluralNoun = buildFormRule(\n word,\n createRulesFromArrays(morphologyData.nouns.regexNoun.singularize)\n );\n if (!isUndefined(baseIfPluralNoun)) {\n // Bring ing-nouns to base forms (\"blessings\" -> \"bless\").\n if (endsWithIng(baseIfPluralNoun)) {\n return buildFormRule(baseIfPluralNoun, createRulesFromArrays(regexVerb.ingFormToInfinitive));\n }\n return baseIfPluralNoun;\n }\n\n // Check if the word ends with \"ic\", \"ical\" or \"ically\". Return the \"ical\" form for consistency.\n const regexAdjective = morphologyData.adjectives.regexAdjective;\n const baseIfIcally = buildFormRule(word, createRulesFromArrays(regexAdjective.icallyToBase));\n if (!isUndefined(baseIfIcally)) {\n return baseIfIcally;\n }\n\n // No more quick guesses, we have to determine a verbal infinitive and an adjectival base.\n const possibleRegularBases = [];\n\n // Verbal infinitive.\n const baseIfVerb = getInfinitive(word, regexVerb).infinitive;\n\n possibleRegularBases.push(baseIfVerb);\n\n // Adjectival base.\n const stopAdjectives = morphologyData.adjectives.stopAdjectives;\n /*\n\t The following list of words are the stem of adjectives that have two syllables or more that receive -er and -est in their comparative and superlative forms, e.g 'shallow'.\n\t Please note that if the adjective ends in -y and -e, the ending is removed, e.g. 'acute' -> 'acut'.\n\t The list is not exhaustive and can be expanded if needed. Oxford dictionary was used to check if the forms indeed exist, e.g. \"acuter\".\n\t */\n const multiSyllableAdjWithSuffixes = morphologyData.adjectives.multiSyllableAdjectives.list;\n\n const baseIfAdjective = getAdjectiveStem(\n word,\n regexAdjective,\n stopAdjectives,\n multiSyllableAdjWithSuffixes\n ).base;\n possibleRegularBases.push(baseIfAdjective);\n\n return findShortestAndAlphabeticallyFirst(possibleRegularBases);\n}\n\n/**\n * Returns the stem of the input word using the morphologyData (language-specific).\n *\n * @param {string} word The word to get the stem for.\n * @param {Object} morphologyData The available morphology data per language (false if unavailable).\n *\n * @returns {string} Stemmed (or base) form of the word.\n */\nexport function determineStem(word, morphologyData) {\n const nounMorphology = morphologyData.nouns;\n\n const baseIfPossessive = buildFormRule(\n word,\n createRulesFromArrays(nounMorphology.regexNoun.possessiveToBase)\n );\n\n let stem;\n let irregular;\n\n // Determine if this is an irregular noun, adjective or verb.\n if (isUndefined(baseIfPossessive)) {\n stem = word;\n // Word can be a noun, adjective or verb.\n irregular =\n determineIrregularStem(word, nounMorphology.irregularNouns) ||\n determineIrregularStem(word, morphologyData.adjectives.irregularAdjectives) ||\n determineIrregularVerbStem(word, morphologyData.verbs);\n } else {\n stem = baseIfPossessive;\n // The word is a possessive, it can only be a noun or an ing-noun;\n irregular = determineIrregularStem(baseIfPossessive, nounMorphology.irregularNouns);\n }\n\n if (irregular) {\n // Found the stem of an irregular word! Return it.\n return irregular;\n }\n\n // Treat the word as a regular noun, adjective or verb.\n return determineRegularStem(stem, morphologyData);\n}\n\nexport default determineStem;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAI0B,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAP1B,MAAM;EAACG,aAAa;EAAEC;AAAqB,CAAC,GAAGC,yBAAkB;AASjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kCAAkCA,CAACC,KAAK,EAAE;EACxD,MAAMC,OAAO,GAAG,IAAAC,eAAO,EAACF,KAAK,CAAC;EAC9B,IAAIG,MAAM,GAAGF,OAAO,CAACG,GAAG,CAAC,CAAC;EAE1BH,OAAO,CAACI,OAAO,CAACC,GAAG,IAAI;IACrB,MAAMC,gBAAgB,GAAGD,GAAG,CAACE,MAAM,GAAGL,MAAM,CAACK,MAAM;IACnD,IAAID,gBAAgB,KAAK,CAAC,EAAE;MAC1B,IAAID,GAAG,CAACG,aAAa,CAACN,MAAM,CAAC,GAAG,CAAC,EAAE;QACjCA,MAAM,GAAGG,GAAG;MACd;IACF,CAAC,MAAM,IAAIC,gBAAgB,GAAG,CAAC,EAAE;MAC/BJ,MAAM,GAAGG,GAAG;IACd;EACF,CAAC,CAAC;EAEF,OAAOH,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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A0B,CAACJ,IAAI,EAAEa,cAAc,CAACC,KAAK,CAAC;EAC1D,CAAC,MAAM;IACL2B,IAAI,GAAGF,gBAAgB;IACvB;IACAG,SAAS,GAAG3C,sBAAsB,CAACwC,gBAAgB,EAAED,cAAc,CAACK,cAAc,CAAC;EACrF;EAEA,IAAID,SAAS,EAAE;IACb;IACA,OAAOA,SAAS;EAClB;;EAEA;EACA,OAAO9B,oBAAoB,CAAC6B,IAAI,EAAE5B,cAAc,CAAC;AACnD;AAAC,IAAAgC,QAAA,GAAAC,OAAA,CAAA9D,OAAA,GAEcqD,aAAa","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = _default;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _countSyllables = require("../../../../helpers/syllables/countSyllables");
|
|
9
9
|
var _syllables = _interopRequireDefault(require("../../config/syllables.json"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAdjectiveStem.js","names":["_index","require","_countSyllables","_syllables","_interopRequireDefault","e","__esModule","default","buildFormRule","createRulesFromArrays","languageProcessing","refineAdjectiveCheck","word","endsWith","nonStemmingExceptions","forcedStemmingExceptions","countSyllables","countSyllablesInWord","syllables","adjectiveEndingInYSuffix","isStemEndingInY","isForcedStemmingException","includes","slice","length","isNonStemmingException","maxSyllables","endsWithAndNoException","constructCanBeFunction","minimumWordLength","checkFunction","wordLength","_default","regexAdjective","stopAdjectives","multiSyllableAdjWithSuffixes","canBeComparative","erExceptions","comparativeToBaseRegex","comparativeToBase","base","guessedForm","canBeSuperlative","estExceptions","superlativeToBaseRegex","superlativeToBase","canBeLyAdverb","lyExceptions","adverbToBaseRegex","adverbToBase"],"sources":["../../../../../../src/languageProcessing/languages/en/helpers/internal/getAdjectiveStem.js"],"sourcesContent":["import {languageProcessing} from '@axyseo/index';\nimport {countSyllablesInWord} from '../../../../helpers/syllables/countSyllables';\nimport syllables from '../../config/syllables.json';\nconst {buildFormRule, createRulesFromArrays} = languageProcessing;\n\n/**\n * Further checks if the word can be a specific adjectival form.\n *\n * @param {string} word\t\tThe word to check.\n * @param {string} endsWith\tThe ending of the form.\n * @param {string[]} nonStemmingExceptions\t\tThe list of words ending with the form that are not this form.\n * @param {string[]} forcedStemmingExceptions\tThe list of words ending with the form that are not caught by the regular rules.\n *\n * @returns {boolean} Whether the word can be a specific adjectival form.\n */\nconst refineAdjectiveCheck = (word, endsWith, nonStemmingExceptions, forcedStemmingExceptions) => {\n const countSyllables = countSyllablesInWord(word, syllables);\n /*\n * This check is based on the regular comparative and superlative formation rules.\n * One syllable adjectives receive -er and -est. The syllable count of the comparative/superlative form is 2.\n * One/two syllable adjectives ending in -e receive -r and -st. The syllable count of the comparative/superlative form is 2.\n * Two syllable adjectives ending in -y receive -ier and -iest. The syllable count of the comparative/superlative form is 3.\n * Words ending in -er/-est that don't follow the above rules are not comparatives/superlatives, unless listed in the exception lists.\n */\n if (word.endsWith(endsWith)) {\n // Words with one syllable or less can't be comparatives/superlatives.\n if (countSyllables <= 1) {\n return false;\n }\n // The suffix for adjectives ending in -y is -ier/-iest.\n const adjectiveEndingInYSuffix = `i${endsWith}`;\n // Checks if the word is an adjective ending in -y that can have suffixes -er/-est. For example, 'pretty'.\n const isStemEndingInY = word.endsWith(adjectiveEndingInYSuffix);\n // Checks if the word is an adjective longer than one syllable that can have suffixes -er/-est (e.g. 'shallow'), OR\n // if the word is an adjective ending in -y containing more than two syllables that can have suffixes -ier/-iest (e.g. 'unlikely').\n const isForcedStemmingException =\n forcedStemmingExceptions.includes(word.slice(0, -adjectiveEndingInYSuffix.length)) ||\n forcedStemmingExceptions.includes(word.slice(0, -endsWith.length));\n // Check if the word ending in -er/-est is not a comparative/superlative (e.g. 'banner').\n const isNonStemmingException = nonStemmingExceptions.includes(word);\n // The maximum syllable count for a word to be a comparative/superlative is 2, unless it ends in -y, then it's 3.\n const maxSyllables = isStemEndingInY ? 3 : 2;\n\n if (isForcedStemmingException || (countSyllables <= maxSyllables && !isNonStemmingException)) {\n return true;\n }\n }\n return false;\n};\n\n/**\n * Checks if the word ends with a specific form and is not in the exceptions list.\n *\n * @param {string} word\t\tThe word to check.\n * @param {string} endsWith\tThe ending of the form.\n * @param {string[]} nonStemmingExceptions \tThe list of words ending with the form that are not this form.\n * @returns {boolean} Whether the word ends with the form and is not in the exceptions list.\n */\nconst endsWithAndNoException = (word, endsWith, nonStemmingExceptions) =>\n word.endsWith(endsWith) && !nonStemmingExceptions.includes(word);\n\n/**\n * Constructs a function that checks if the input word can be a specific adjectival form.\n *\n * @param {string} endsWith How the form ends.\n * @param {int} minimumWordLength How long the word should be to classify for this form.\n * @param {string[]} [nonStemmingExceptions=[]]\t\tThe list of words with that ending (endsWith) which are not this form.\n * @param {string[]}\t[forcedStemmingExceptions=[]]\tThe list of words with that ending (endsWith) which are not caught by the regular rules.\n * @param {Function} [checkFunction=endsWithAndNoException]\tAn extra check to determine if the word is this form.\n *\n * @returns {Function} A function that checks if the input word can be a specific adjectival form.\n */\nconst constructCanBeFunction = function(\n endsWith,\n minimumWordLength,\n nonStemmingExceptions = [],\n forcedStemmingExceptions = [],\n checkFunction = endsWithAndNoException\n) {\n return word => {\n const wordLength = word.length;\n\n if (wordLength < minimumWordLength) {\n return false;\n }\n return checkFunction(word, endsWith, nonStemmingExceptions, forcedStemmingExceptions);\n };\n};\n\n/**\n * Forms the base form from an input word.\n *\n * @param {string} word The word to build the base form for.\n * @param {Object} regexAdjective The lists of regexes to apply to stem adjectives.\n * @param {Array} regexAdjective.comparativeToBaseRegex The Array of regex-based rules to bring comparatives to base.\n * @param {Array} regexAdjective.superlativeToBaseRegex The Array of regex-based rules to bring superlatives to base.\n * @param {Array} regexAdjective.adverbToBaseRegex The Array of regex-based rules to bring adverbs to base.\n * @param {Object} stopAdjectives The lists of words that are not adverbs.\n * @param {string[]} stopAdjectives.erExceptions The list of words that end with -er and are not comparatives.\n * @param {string[]} stopAdjectives.estExceptions The list of words that end with -est and are not superlatives.\n * @param {string[]} stopAdjectives.lyExceptions The list of words that end with -ly and are not adverbs.\n * @param {string[]} multiSyllableAdjWithSuffixes The list of adjectives containing more than 2 syllables that can have suffixes.\n *\n * @returns {Object} The base form of the input word.\n */\nexport default function(word, regexAdjective, stopAdjectives, multiSyllableAdjWithSuffixes) {\n /*\n * Check comparatives: Consider only words of four letters or more (otherwise, words like \"per\" are being treated\n * as comparatives).\n */\n const canBeComparative = constructCanBeFunction(\n 'er',\n 4,\n stopAdjectives.erExceptions,\n multiSyllableAdjWithSuffixes,\n refineAdjectiveCheck\n );\n if (canBeComparative(word)) {\n const comparativeToBaseRegex = createRulesFromArrays(regexAdjective.comparativeToBase);\n return {\n base: buildFormRule(word, comparativeToBaseRegex) || word,\n guessedForm: 'er'\n };\n }\n\n /*\n * Check superlatives: Consider only words of five letters or more (otherwise, words like \"test\" are being treated\n * as superlatives).\n */\n const canBeSuperlative = constructCanBeFunction(\n 'est',\n 5,\n stopAdjectives.estExceptions,\n multiSyllableAdjWithSuffixes,\n refineAdjectiveCheck\n );\n if (canBeSuperlative(word)) {\n const superlativeToBaseRegex = createRulesFromArrays(regexAdjective.superlativeToBase);\n return {\n base: buildFormRule(word, superlativeToBaseRegex) || word,\n guessedForm: 'est'\n };\n }\n\n /*\n * Check ly-adverbs: Consider only words of five letters or more (otherwise, words like \"lily\" are being treated\n * as ly-adverbs).\n */\n const canBeLyAdverb = constructCanBeFunction('ly', 5, stopAdjectives.lyExceptions);\n if (canBeLyAdverb(word)) {\n const adverbToBaseRegex = createRulesFromArrays(regexAdjective.adverbToBase);\n return {\n base: buildFormRule(word, adverbToBaseRegex),\n guessedForm: 'ly'\n };\n }\n\n return {\n base: word,\n guessedForm: 'base'\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC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IACf,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACE,MAAMC,gBAAgB,GAAGd,sBAAsB,CAC7C,KAAK,EACL,CAAC,EACDM,cAAc,CAACS,aAAa,EAC5BR,4BAA4B,EAC5BxB,oBACF,CAAC;EACD,IAAI+B,gBAAgB,CAAC9B,IAAI,CAAC,EAAE;IAC1B,MAAMgC,sBAAsB,GAAGnC,qBAAqB,CAACwB,cAAc,CAACY,iBAAiB,CAAC;IACtF,OAAO;MACLL,IAAI,EAAEhC,aAAa,CAACI,IAAI,EAAEgC,sBAAsB,CAAC,IAAIhC,IAAI;MACzD6B,WAAW,EAAE;IACf,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACE,MAAMK,aAAa,GAAGlB,sBAAsB,CAAC,IAAI,EAAE,CAAC,EAAEM,cAAc,CAACa,YAAY,CAAC;EAClF,IAAID,aAAa,CAAClC,IAAI,CAAC,EAAE;IACvB,MAAMoC,iBAAiB,GAAGvC,qBAAqB,CAACwB,cAAc,CAACgB,YAAY,CAAC;IAC5E,OAAO;MACLT,IAAI,EAAEhC,aAAa,CAACI,IAAI,EAAEoC,iBAAiB,CAAC;MAC5CP,WAAW,EAAE;IACf,CAAC;EACH;EAEA,OAAO;IACLD,IAAI,EAAE5B,IAAI;IACV6B,WAAW,EAAE;EACf,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"getAdjectiveStem.js","names":["_index","require","_countSyllables","_syllables","_interopRequireDefault","e","__esModule","default","buildFormRule","createRulesFromArrays","languageProcessing","refineAdjectiveCheck","word","endsWith","nonStemmingExceptions","forcedStemmingExceptions","countSyllables","countSyllablesInWord","syllables","adjectiveEndingInYSuffix","isStemEndingInY","isForcedStemmingException","includes","slice","length","isNonStemmingException","maxSyllables","endsWithAndNoException","constructCanBeFunction","minimumWordLength","checkFunction","wordLength","_default","regexAdjective","stopAdjectives","multiSyllableAdjWithSuffixes","canBeComparative","erExceptions","comparativeToBaseRegex","comparativeToBase","base","guessedForm","canBeSuperlative","estExceptions","superlativeToBaseRegex","superlativeToBase","canBeLyAdverb","lyExceptions","adverbToBaseRegex","adverbToBase"],"sources":["../../../../../../src/languageProcessing/languages/en/helpers/internal/getAdjectiveStem.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nimport {countSyllablesInWord} from '../../../../helpers/syllables/countSyllables';\nimport syllables from '../../config/syllables.json';\nconst {buildFormRule, createRulesFromArrays} = languageProcessing;\n\n/**\n * Further checks if the word can be a specific adjectival form.\n *\n * @param {string} word\t\tThe word to check.\n * @param {string} endsWith\tThe ending of the form.\n * @param {string[]} nonStemmingExceptions\t\tThe list of words ending with the form that are not this form.\n * @param {string[]} forcedStemmingExceptions\tThe list of words ending with the form that are not caught by the regular rules.\n *\n * @returns {boolean} Whether the word can be a specific adjectival form.\n */\nconst refineAdjectiveCheck = (word, endsWith, nonStemmingExceptions, forcedStemmingExceptions) => {\n const countSyllables = countSyllablesInWord(word, syllables);\n /*\n * This check is based on the regular comparative and superlative formation rules.\n * One syllable adjectives receive -er and -est. The syllable count of the comparative/superlative form is 2.\n * One/two syllable adjectives ending in -e receive -r and -st. The syllable count of the comparative/superlative form is 2.\n * Two syllable adjectives ending in -y receive -ier and -iest. The syllable count of the comparative/superlative form is 3.\n * Words ending in -er/-est that don't follow the above rules are not comparatives/superlatives, unless listed in the exception lists.\n */\n if (word.endsWith(endsWith)) {\n // Words with one syllable or less can't be comparatives/superlatives.\n if (countSyllables <= 1) {\n return false;\n }\n // The suffix for adjectives ending in -y is -ier/-iest.\n const adjectiveEndingInYSuffix = `i${endsWith}`;\n // Checks if the word is an adjective ending in -y that can have suffixes -er/-est. For example, 'pretty'.\n const isStemEndingInY = word.endsWith(adjectiveEndingInYSuffix);\n // Checks if the word is an adjective longer than one syllable that can have suffixes -er/-est (e.g. 'shallow'), OR\n // if the word is an adjective ending in -y containing more than two syllables that can have suffixes -ier/-iest (e.g. 'unlikely').\n const isForcedStemmingException =\n forcedStemmingExceptions.includes(word.slice(0, -adjectiveEndingInYSuffix.length)) ||\n forcedStemmingExceptions.includes(word.slice(0, -endsWith.length));\n // Check if the word ending in -er/-est is not a comparative/superlative (e.g. 'banner').\n const isNonStemmingException = nonStemmingExceptions.includes(word);\n // The maximum syllable count for a word to be a comparative/superlative is 2, unless it ends in -y, then it's 3.\n const maxSyllables = isStemEndingInY ? 3 : 2;\n\n if (isForcedStemmingException || (countSyllables <= maxSyllables && !isNonStemmingException)) {\n return true;\n }\n }\n return false;\n};\n\n/**\n * Checks if the word ends with a specific form and is not in the exceptions list.\n *\n * @param {string} word\t\tThe word to check.\n * @param {string} endsWith\tThe ending of the form.\n * @param {string[]} nonStemmingExceptions \tThe list of words ending with the form that are not this form.\n * @returns {boolean} Whether the word ends with the form and is not in the exceptions list.\n */\nconst endsWithAndNoException = (word, endsWith, nonStemmingExceptions) =>\n word.endsWith(endsWith) && !nonStemmingExceptions.includes(word);\n\n/**\n * Constructs a function that checks if the input word can be a specific adjectival form.\n *\n * @param {string} endsWith How the form ends.\n * @param {int} minimumWordLength How long the word should be to classify for this form.\n * @param {string[]} [nonStemmingExceptions=[]]\t\tThe list of words with that ending (endsWith) which are not this form.\n * @param {string[]}\t[forcedStemmingExceptions=[]]\tThe list of words with that ending (endsWith) which are not caught by the regular rules.\n * @param {Function} [checkFunction=endsWithAndNoException]\tAn extra check to determine if the word is this form.\n *\n * @returns {Function} A function that checks if the input word can be a specific adjectival form.\n */\nconst constructCanBeFunction = function(\n endsWith,\n minimumWordLength,\n nonStemmingExceptions = [],\n forcedStemmingExceptions = [],\n checkFunction = endsWithAndNoException\n) {\n return word => {\n const wordLength = word.length;\n\n if (wordLength < minimumWordLength) {\n return false;\n }\n return checkFunction(word, endsWith, nonStemmingExceptions, forcedStemmingExceptions);\n };\n};\n\n/**\n * Forms the base form from an input word.\n *\n * @param {string} word The word to build the base form for.\n * @param {Object} regexAdjective The lists of regexes to apply to stem adjectives.\n * @param {Array} regexAdjective.comparativeToBaseRegex The Array of regex-based rules to bring comparatives to base.\n * @param {Array} regexAdjective.superlativeToBaseRegex The Array of regex-based rules to bring superlatives to base.\n * @param {Array} regexAdjective.adverbToBaseRegex The Array of regex-based rules to bring adverbs to base.\n * @param {Object} stopAdjectives The lists of words that are not adverbs.\n * @param {string[]} stopAdjectives.erExceptions The list of words that end with -er and are not comparatives.\n * @param {string[]} stopAdjectives.estExceptions The list of words that end with -est and are not superlatives.\n * @param {string[]} stopAdjectives.lyExceptions The list of words that end with -ly and are not adverbs.\n * @param {string[]} multiSyllableAdjWithSuffixes The list of adjectives containing more than 2 syllables that can have suffixes.\n *\n * @returns {Object} The base form of the input word.\n */\nexport default function(word, regexAdjective, stopAdjectives, multiSyllableAdjWithSuffixes) {\n /*\n * Check comparatives: Consider only words of four letters or more (otherwise, words like \"per\" are being treated\n * as comparatives).\n */\n const canBeComparative = constructCanBeFunction(\n 'er',\n 4,\n stopAdjectives.erExceptions,\n multiSyllableAdjWithSuffixes,\n refineAdjectiveCheck\n );\n if (canBeComparative(word)) {\n const comparativeToBaseRegex = createRulesFromArrays(regexAdjective.comparativeToBase);\n return {\n base: buildFormRule(word, comparativeToBaseRegex) || word,\n guessedForm: 'er'\n };\n }\n\n /*\n * Check superlatives: Consider only words of five letters or more (otherwise, words like \"test\" are being treated\n * as superlatives).\n */\n const canBeSuperlative = constructCanBeFunction(\n 'est',\n 5,\n stopAdjectives.estExceptions,\n multiSyllableAdjWithSuffixes,\n refineAdjectiveCheck\n );\n if (canBeSuperlative(word)) {\n const superlativeToBaseRegex = createRulesFromArrays(regexAdjective.superlativeToBase);\n return {\n base: buildFormRule(word, superlativeToBaseRegex) || word,\n guessedForm: 'est'\n };\n }\n\n /*\n * Check ly-adverbs: Consider only words of five letters or more (otherwise, words like \"lily\" are being treated\n * as ly-adverbs).\n */\n const canBeLyAdverb = constructCanBeFunction('ly', 5, stopAdjectives.lyExceptions);\n if (canBeLyAdverb(word)) {\n const adverbToBaseRegex = createRulesFromArrays(regexAdjective.adverbToBase);\n return {\n base: buildFormRule(word, adverbToBaseRegex),\n guessedForm: 'ly'\n };\n }\n\n return {\n base: word,\n guessedForm: 'base'\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAoD,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AACpD,MAAM;EAACG,aAAa;EAAEC;AAAqB,CAAC,GAAGC,yBAAkB;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAGA,CAACC,IAAI,EAAEC,QAAQ,EAAEC,qBAAqB,EAAEC,wBAAwB,KAAK;EAChG,MAAMC,cAAc,GAAG,IAAAC,oCAAoB,EAACL,IAAI,EAAEM,kBAAS,CAAC;EAC5D;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIN,IAAI,CAACC,QAAQ,CAACA,QAAQ,CAAC,EAAE;IAC3B;IACA,IAAIG,cAAc,IAAI,CAAC,EAAE;MACvB,OAAO,KAAK;IACd;IACA;IACA,MAAMG,wBAAwB,GAAG,IAAIN,QAAQ,EAAE;IAC/C;IACA,MAAMO,eAAe,GAAGR,IAAI,CAACC,QAAQ,CAACM,wBAAwB,CAAC;IAC/D;IACA;IACA,MAAME,yBAAyB,GAC7BN,wBAAwB,CAACO,QAAQ,CAACV,IAAI,CAACW,KAAK,CAAC,CAAC,EAAE,CAACJ,wBAAwB,CAACK,MAAM,CAAC,CAAC,IAClFT,wBAAwB,CAACO,QAAQ,CAACV,IAAI,CAACW,KAAK,CAAC,CAAC,EAAE,CAACV,QAAQ,CAACW,MAAM,CAAC,CAAC;IACpE;IACA,MAAMC,sBAAsB,GAAGX,qBAAqB,CAACQ,QAAQ,CAACV,IAAI,CAAC;IACnE;IACA,MAAMc,YAAY,GAAGN,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iBAAiB,CAAC;IACtF,OAAO;MACLC,IAAI,EAAEhC,aAAa,CAACI,IAAI,EAAE0B,sBAAsB,CAAC,IAAI1B,IAAI;MACzD6B,WAAW,EAAE;IACf,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACE,MAAMC,gBAAgB,GAAGd,sBAAsB,CAC7C,KAAK,EACL,CAAC,EACDM,cAAc,CAACS,aAAa,EAC5BR,4BAA4B,EAC5BxB,oBACF,CAAC;EACD,IAAI+B,gBAAgB,CAAC9B,IAAI,CAAC,EAAE;IAC1B,MAAMgC,sBAAsB,GAAGnC,qBAAqB,CAACwB,cAAc,CAACY,iBAAiB,CAAC;IACtF,OAAO;MACLL,IAAI,EAAEhC,aAAa,CAACI,IAAI,EAAEgC,sBAAsB,CAAC,IAAIhC,IAAI;MACzD6B,WAAW,EAAE;IACf,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACE,MAAMK,aAAa,GAAGlB,sBAAsB,CAAC,IAAI,EAAE,CAAC,EAAEM,cAAc,CAACa,YAAY,CAAC;EAClF,IAAID,aAAa,CAAClC,IAAI,CAAC,EAAE;IACvB,MAAMoC,iBAAiB,GAAGvC,qBAAqB,CAACwB,cAAc,CAACgB,YAAY,CAAC;IAC5E,OAAO;MACLT,IAAI,EAAEhC,aAAa,CAACI,IAAI,EAAEoC,iBAAiB,CAAC;MAC5CP,WAAW,EAAE;IACf,CAAC;EACH;EAEA,OAAO;IACLD,IAAI,EAAE5B,IAAI;IACV6B,WAAW,EAAE;EACf,CAAC;AACH","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = getParticiples;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _index = require("
|
|
8
|
+
var _index = require("../../../index");
|
|
9
9
|
var _passiveVoiceIrregulars = _interopRequireDefault(require("../../config/internal/passiveVoiceIrregulars"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getParticiples.js","names":["_lodash","require","_index","_passiveVoiceIrregulars","_interopRequireDefault","e","__esModule","default","matchRegularParticiples","getWords","languageProcessing","getParticiples","clauseText","words","foundParticiples","forEach","word","regex","length","includes","irregularParticiples","push"],"sources":["../../../../../../src/languageProcessing/languages/en/helpers/internal/getParticiples.js"],"sourcesContent":["import {forEach, includes} from 'lodash';\nimport {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getParticiples.js","names":["_lodash","require","_index","_passiveVoiceIrregulars","_interopRequireDefault","e","__esModule","default","matchRegularParticiples","getWords","languageProcessing","getParticiples","clauseText","words","foundParticiples","forEach","word","regex","length","includes","irregularParticiples","push"],"sources":["../../../../../../src/languageProcessing/languages/en/helpers/internal/getParticiples.js"],"sourcesContent":["import {forEach, includes} from 'lodash';\nimport {languageProcessing} from '../../../index';\nconst {matchRegularParticiples, getWords} = languageProcessing;\n\nimport irregularParticiples from '../../config/internal/passiveVoiceIrregulars';\n\n/**\n * Creates participle array for the participles found in a clause.\n *\n * @param {string} clauseText The clause to find participles in\n *\n * @returns {Array} The list with participles.\n */\nexport default function getParticiples(clauseText) {\n const words = getWords(clauseText);\n const foundParticiples = [];\n\n forEach(words, function(word) {\n const regex = [/\\w+ed($|[ \\n\\r\\t.,'()\"+\\-;!?:/»«‹›<>])/gi];\n if (matchRegularParticiples(word, regex).length !== 0 || includes(irregularParticiples, word)) {\n foundParticiples.push(word);\n }\n });\n return foundParticiples;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,uBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAgF,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFhF,MAAM;EAACG,uBAAuB;EAAEC;AAAQ,CAAC,GAAGC,yBAAkB;AAI9D;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAACC,UAAU,EAAE;EACjD,MAAMC,KAAK,GAAGJ,QAAQ,CAACG,UAAU,CAAC;EAClC,MAAME,gBAAgB,GAAG,EAAE;EAE3B,IAAAC,eAAO,EAACF,KAAK,EAAE,UAASG,IAAI,EAAE;IAC5B,MAAMC,KAAK,GAAG,CAAC,0CAA0C,CAAC;IAC1D,IAAIT,uBAAuB,CAACQ,IAAI,EAAEC,KAAK,CAAC,CAACC,MAAM,KAAK,CAAC,IAAI,IAAAC,gBAAQ,EAACC,+BAAoB,EAAEJ,IAAI,CAAC,EAAE;MAC7FF,gBAAgB,CAACO,IAAI,CAACL,IAAI,CAAC;IAC7B;EACF,CAAC,CAAC;EACF,OAAOF,gBAAgB;AACzB","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.normalizePrefixed = exports.getInfinitive = exports.endsWithIng = exports.checkIrregulars = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _index = require("
|
|
8
|
+
var _index = require("../../../index");
|
|
9
9
|
// "use strict";
|
|
10
10
|
|
|
11
11
|
const {
|