summaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
Commit message (Collapse)AuthorAge
* Remove the dictionary tag from the definitionTags (#1324)toasted-nutbread2021-01-28
| | | | | | | | | | | * Remove dictionary tag from term definitionTags and kanji tags * Update test data * Update templates * Update tests * Update information
* Core refactor (#1207)toasted-nutbread2021-01-07
| | | | | | | | | | | | | | | | | | | | | | | | | * Copy set intersection functions * Remove unused functions * Simplify url check * Remove parseUrl * Simplify stringReverse * Remove hasOwn due to infrequent use * Rename errorToJson/jsonToError to de/serializeError For clarity on intended use. * Fix time argument on timeout * Add missing return value * Throw an error for unexpected argument values * Add documentation comments
* Translator regex replacements (#1199)toasted-nutbread2021-01-03
| | | | | | | | | | | | | | | | | | | * Add support for regex replacements during the translation process * Allow assignment of textReplacements * Rename * Set up test data * Write expected data * Set up options * Prevent infinite loop if regex matches empty string * Implement setting controller * Add support for testing pattern replacements
* Simplify collapseEmphaticOptions options (#1196)toasted-nutbread2021-01-01
|
* Update copyright year (#1194)toasted-nutbread2021-01-01
| | | | | * Update copyright year * Remove redundant Author info
* Translator frequency data improvements (#1184)toasted-nutbread2020-12-30
| | | | | | | * Specify if a frequency has a specific reading * Make frequency data creation more standardized * Update test data
* Update termTags for termGrouped mode to include all definition tags (#1138)toasted-nutbread2020-12-19
| | | | | * Update termTags for termGrouped mode to include all definition tags * Update tests
* Database test updates (#1086)toasted-nutbread2020-12-08
| | | | | | | | | | | | | | | * Remove unused * Create DatabaseVM * Update sequences in test dictionary * Update documentation * Add second valid testing dictionary * Set up translator tests * Write expected data
* JapaneseUtil normalization (#1076)toasted-nutbread2020-11-29
| | | | | * Use JapaneseUtil as a class which is manually instantiated * Use alias function for toKana
* Fix incorrect frequency field being used (#1059)toasted-nutbread2020-11-24
|
* Fix term details not using the expanded tags (#1028)toasted-nutbread2020-11-14
|
* Compact tags refactor (#1021)toasted-nutbread2020-11-12
| | | | | | | | | | | | | * Update translator to flag redundant tags instead of remove * Update how compact tags are shown in the popup * Pass compactTags option to note builder * Update options templates * Add options upgrade * Add options upgrade test
* Fix display issues (#984)toasted-nutbread2020-11-01
| | | | | | | | | | | | | | | * Remove unused function * Update expresionMulti detection * Simplify kanji early escape * Simplify frequency/pitch data creation * Update implementation of _buildTermMeta * Update how pitch accents sources are collected * Remove old _buildTermMeta
* Fix data inconsistencies (#891)toasted-nutbread2020-10-06
| | | | | | | | | | | | | * Simplify variable name * Add dictionaryNames array * Update how the dictionary field is assigned * Use "dictionary" instead of "title" for consistency * Remove redundant dictionary name * Use _expandTags to create pitch accent tags
* Update merged definitions to have consistent structure (#890)toasted-nutbread2020-10-06
| | | | | * Update comment about definitions type * Add conversion to ensure consistent data structure
* Don't add duplicate definitions (#889)toasted-nutbread2020-10-05
|
* Dictionary definition structure fixes (#888)toasted-nutbread2020-10-05
| | | | | * Restore support for tags without metadata * Fix missing spread
* Fix incorrect definitions array being used for compatibility merged ↵toasted-nutbread2020-10-04
| | | | definitions (#887)
* Fix primary audio source (#886)toasted-nutbread2020-10-04
| | | | | | | | | * Add abstraction: _getDefinitionPrimaryExpressionAndReading * Reuse existing definitions in a sequence * Revert change to related definition source/rawSource/sourceTerm * Update _getDefinitionPrimaryExpressionAndReading to return best match
* Fix doc comments for translation options (#885)toasted-nutbread2020-10-04
|
* Translator organization (#884)toasted-nutbread2020-10-04
| | | | | | | | | | | | | | | | | | | | | * Group reduction functions together * Group simple helpers * Add label comments * Move core _findTerms functions to top * Move _getSecondarySearchDictionaryMap and _getDictionaryPriority * Move tag helpers * Move _getTextOptionEntryVariants * Move functions up * Move functions up * Update label comments
* Add check to verify expressions are strings (#883)toasted-nutbread2020-10-04
|
* Add sourceTermExactMatchCount to prioritize exact expression matches (#882)toasted-nutbread2020-10-04
|
* Translator definition source term (and other info) (#881)toasted-nutbread2020-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add sourceTerm field to 'term' and 'termGrouped' definitions * Fix comparison of expressions which are always the same * Rename/restructure term info map * Add source term * Add sourceTerm to expressions array * Reuse furiganaSegments * Add helper function _createExpressionDetailsListFromTermInfoMap * Add expressions array to termMergedByGlossary * Add expressions to definition types 'term' and 'termGrouped' * Rename expressionDetails* to termDetails* * Correct the source/rawSource/sourceTerm for related sequenced definitions * Simplify structure of sequencedDefinitions * Remove TODO
* Move deinflection reasons setup to backend (#880)toasted-nutbread2020-10-04
| | | | | * Move deinflection reasons setup to backend * Remove async
* Translator options refactor (#879)toasted-nutbread2020-10-04
| | | | | | | | | | | | | * Refactor internal options for findTerms to not use the settings object * Move findTerms/findKanji options creation * Deconstruct used options values to variables before any await calls * Rename findTermsOptions to just options * Add documentation comments * Add type information about definitions
* Translator refactoring (#878)toasted-nutbread2020-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add helper function _getSecondarySearchDictionaryMap * Use spreads instead of concat * Create helper function for assigning disambiguation info * Add _getTermTagsScoreSum helper * Rename variables * Move assignment of definition details * Convert databaseDefinitions to standard definitions * Move creation of definitions * Always pass definitionsByGlossary directly to _mergeByGlossary * Refactor how used definitions are tracked * Change _mergeByGlossary parameters * Simplify _mergeByGlossary * Generate definition structure at the end of the function * Add reusable function to clone a tag * Restructure merged sub-definition creation * Move setup of totalExpressionSet/totalReadingSet * Track all definitions with matching glossary * Move creation of definitionTags * Update score calculation for multiple definitions * Disambiguate function name * Rename variables * Add helper function _createMergedGlossaryTermDefinition * Remove rarely used check for secondary search results Unclear what the purpose was since it was almost never used * Update data structure * Rename function/variable * Add helper functions _createMergedTermDefinition * Assign expressionDetails to variable * Add rawSource to grouped definitions * Use shared function for creating unused definition entries * Add helper function _createMapKey * Refactor _createExpressionDetails * Change argument order * Add _getTagNamesWithCategory helper * Optimize _compressDefinitionTags * Add _createGroupedTermDefinition helper * Add type information * Use consistent order for term definition fields, add comments for omitted fields * Remove unused index field * Add helper function _createKanjiDefinition * Update types * Add frequencies/pitches arrays * Update terms array setup * Simplify for loop * Remove redundant property assignment * Simplify how deinflections with no definitions are ignored * Ensure duplicates are removed * Rename variable * Add comments about duplicate data * Refactor variable/parameter names * Move functions * Rename functions * Rename variable * Add dictionaryPriority field * Simplify priority comparison * Rename argument * Optimize comparison function when dictionary priority is not needed * Add length check * Remove unused parameter * Rename variables/parameters * Rename dictionaries to enabledDictionaryMap * Store compactTags/mainDictionary options to variables * Refactor _getSearchableText
* Dictionary data structure improvements (#877)toasted-nutbread2020-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Simplify object structure of deinflections * Modify existing array when removing duplicates * Update _sortDefinitions to not return a value * Use explicit argument value * Use a Collator for string comparisons * Simplify order comparison * Improve tag creation and sanitization * Switch .map to a for loop, skip null meta * Add _createKanjiStat * Move _sortDefinitions definition * Fix kanji stat sorting * Remove return value from _sortTags * Add _sortKanji * Add fast exits for sorting * Add _sortDefinitionsByIndex * Combine sort function * Improve creation of kanji definition data * Use "databaseDefinitions" instead of "definitions" to disambiguate * Simplify * Simplify further * Simplify max length calculation * More destructuring * Use databaseDefinitions variable name * Move _mergeBySequence body into _getSequencedDefinitions * Use databaseDefinitions field name * Move maxLength calculation * Use shared _createTermDefinitionFromDatabaseDefinition * Simplify map * Move definition sorts for better consistency and less redundancy * Move _createExpression function * Update setup of sequenced definitions * Simplify for loop
* Merge dictionary.js functions into Translator class (#726)toasted-nutbread2020-08-09
| | | | | | | | | | | | | * Move dictFieldSplit * Copy dictionary.js definitions into translator.js * Convert to member functions * Refactor names * Remove dictionary.js * Rename
* Translator refactor (#720)toasted-nutbread2020-08-09
| | | | | | | | | | | | | | | * Move simple find sort into translator.js * Remove unused * Use direct reference to database * Make field private * Remove statics * Convert functions to private * Organize by public/private
* Fix fetch requests (#708)toasted-nutbread2020-08-02
| | | | | | | | | | | | | | | | | * Revert audio fetching functionality to use XMLHttpRequest * Replace requestJson * Replace requestJson * Replace requestJson * Replace requestJson and requestText * Fix tests * Include support for vulgar word searches * Remove request.js
* Move util database modification functions (#499)toasted-nutbread2020-05-06
| | | | | | | | | | | | | | | | | | | * Update onProgress callback to handle multiple arguments * Add apiImportDictionaryArchive * Add apiDeleteDictionary * Make onProgress the last argument for consistency * Remove deprecated util functions * Fix issue with missing progress args * Remove function calls which modify the database from Translator * Update tests * Fix errors not being serialized correctly in _createActionListenerPort
* Merge pull request #450 from toasted-nutbread/frequency-readingstoasted-nutbread2020-04-18
|\ | | | | Add support for filtering frequency metadata based on readings
| * Add support for filtering frequency metadata based on readingstoasted-nutbread2020-04-11
| |
* | Merge pull request #440 from toasted-nutbread/collapse-emphatic-sequencestoasted-nutbread2020-04-12
|\ \ | |/ |/| Add support for collapsing emphatic character sequences
| * Fix 'full' mode not being a superset of 'true' modetoasted-nutbread2020-04-11
| |
| * Add support for collapsing emphatic character sequencestoasted-nutbread2020-04-10
| |
* | Update license author field to broader to explicitly reflect thatAlex Yatskov2020-04-10
|/ | | | | Yomichan is an ongoing community project. It really does take a village, and everyone who contributes code owns a part of it :)
* Merge pull request #424 from toasted-nutbread/dictionary-importertoasted-nutbread2020-04-05
|\ | | | | Dictionary importer
| * Move database creation into Backendtoasted-nutbread2020-03-30
| |
* | Merge pull request #423 from toasted-nutbread/text-source-maptoasted-nutbread2020-04-05
|\ \ | | | | | | Text source map
| * | Create simplified source map classtoasted-nutbread2020-03-28
| |/
* / Add support for returning pitch data from the databasetoasted-nutbread2020-03-28
|/
* Fix case issuetoasted-nutbread2020-03-15
|
* Convert Japanese utilities to a module-like styletoasted-nutbread2020-03-15
|
* Update global declarationstoasted-nutbread2020-03-10
|
* Replace charCodeAt and fromCharCode with codePointAt and fromCodePointtoasted-nutbread2020-03-09
|
* compatibility transform non-primary definitionssiikamiika2020-03-01
|
* Updates for PR feedbacktoasted-nutbread2020-02-22
|
* Reduce number of redundant Map.get calls in dictTermsMergeByGlosstoasted-nutbread2020-02-22
|