Commit Graph

77 Commits

Author SHA1 Message Date
toasted-nutbread
8a377cabe6
matchType/deinflect distinction (#2040)
* Pass a "deinflect" option to findTerms

* Update Translator to use deinflect option

* Fix test input options
2021-12-17 17:02:13 -05:00
toasted-nutbread
8e548a17eb
Dictionary database term source info (#2039)
* Update DictionaryDatabase._findMultiBulk's createResult callback signature

* Simplify _splitField use

* Update sequence

* Expose new fields 'matchType' and 'matchSource' as part of term data

* Expose matchType and matchSource as part of TermSource

* Update sourceTermExactMatchCount calculation

* Update test data

* Expose matchType and matchSource info in HTML attributes

* Add primaryMatchTypes attribute
2021-12-17 16:44:14 -05:00
toasted-nutbread
75aabd983d
String frequency support (#1989)
* Restore support for string frequency values

* Add support for {value, displayValue} frequencies

* Update test data

* Improve number parsing of string frequencies

* Improve reading detection

* Expose a displayValue property for frequency information

* Update docs

* Expose displayValue to Anki note data

* Fix translator

* Update display generation

* Update test data

* Update counts
2021-10-14 21:26:53 -04:00
toasted-nutbread
9899727d7d
Frequency dictionary sort (#1938)
* Add sortDictionary/sortDictionaryOrder options

* Update options

* Add API.getTermFrequencies

* Add settings

* Implement frequency dictionary sorting

* Update test

* Update test data

* Fix handling of undefined rank-based frequencies
2021-09-26 11:08:16 -04:00
toasted-nutbread
f68ad1f843
Structured content data (#1930)
* Add support for structured-content data attributes

* Assign dataset properties

* Don't remove data-sc attributes

* Use helper functions

* Update test data
2021-09-04 12:43:56 -04:00
toasted-nutbread
02194fcb9f
Add support for structured content margins (#1920) 2021-08-31 21:08:30 -04:00
toasted-nutbread
73f06a3fa0
Fix definition image aspect ratio issue (#1847)
* Fix incorrect aspect ratio

* Update test data
2021-07-22 18:11:46 -04:00
toasted-nutbread
2ee3e3a7a1
Update pronunciation anki templates (#1842)
* Update anki pronunciation templates

* Expose nasalPositions/devoicePositions

* Update templates to support nasal/devoice positions

* Update test data
2021-07-18 16:01:42 -04:00
toasted-nutbread
40cdb4feb5
Update valid-dictionary1 data (#1841)
* Add example definitions for pronunciation metadata

* Update counts

* Update tests
2021-07-18 15:52:40 -04:00
toasted-nutbread
3e938f1a1f
Display pronunciation refactor (#1835)
* Simplify svg and container styles

* Rename pitch-accent-details to pitch-accent-graph-container

* Rename pitch-accent-graph* to pronunciation-graph*

* Remove unused template

* Omit quotes

* Rename pitch-accent-character to pronunciation-mora

* Simplify names

* Replace pronunciation-mora-inner with pronunciation-character

* Improve grouping of nasal characters

* Simplify character replacement

* Replace pseudo-elements with real elements

* Use an element rather than a fragment

* Rename functions

* Add wrapper

* Rename pitch-accent-characters to pronunciation-text-container

* Update test data

* Update downstep notation generation

* Rename pitch-accent-position to pronunciation-downstep-notation-container

* Space

* Wrap pronunciations in a container node

* Update preview

* Embed pitch accent styles directly
2021-07-17 14:44:36 -04:00
toasted-nutbread
41fc76d6fd
Devoice and nasal pronunciation info (#1832)
* Update schema to support information about nasal and devoiced mora

* Expose nasalPositions and devoicePositions in dictionary entry data

* Expose nasalPositions, devoicePositions in grouped pitch info

* Update display generator

* Update test dictionary data

* Update test data
2021-07-15 22:39:33 -04:00
toasted-nutbread
8c68fa4d94
Anki text furigana parsing and {sentence-furigana} marker (#1814)
* Add support for textFurigana media

* Add readingMode parameter

* Implement readingMode

* Add {sentence-furigana} marker

* Fallback to sentence if furigana isn't available

* Update test data
2021-07-09 17:48:27 -04:00
toasted-nutbread
315dc425e4
Anki card selected text (#1809)
* Add support for injecting the text selection into Anki cards

* Add selection-text

* Upgrade to add {selection-text}

* Update descriptions

* Update test data
2021-07-07 20:00:30 -04:00
toasted-nutbread
e88d63fc6d
Template renderer media updates (#1802)
* Add TemplateRendererMediaProvider to abstract media-related functionality

* Update representation of injected media

* Update templates

* Update upgrade file

* Update tests

* Update test data

* Force media to be an object

* Update test data
2021-07-06 19:43:53 -04:00
toasted-nutbread
ca97e38bd2
Anki support for structured-content (#1786)
* Update how glossary text is formatted

* Update structured content and image generation

* Pass root data to _createStructuredContentGenerator

* Implement media URLs

* Update documentation

* Update options util

* Apply styles to content

* Improve HTML normalization

* Update DatabaseVM.fetch function

* Update test

* Update test data
2021-07-02 22:46:38 -04:00
toasted-nutbread
845070b817
Translator sorting updates (#1755)
* Update when definition sorting takes place

* Update test data

* Change order of sorting
2021-06-26 12:37:38 -04:00
toasted-nutbread
6e0a367afc
Translator data format updates (#1754)
* Add {dictionaryIndex, dictionaryPriority} to definitions

* Add score to definitions

* Add id to definition

* Use definition id instead of ids array

* Remove ids array

* Update docs

* Update test data
2021-06-26 11:57:09 -04:00
toasted-nutbread
5756885fa9
Structured content updates (#1753)
* Update schema

* Update content generation

* Update styles

* Update test data

* Update style names
2021-06-25 17:24:29 -04:00
toasted-nutbread
7ae964c830
Structured content updates (#1733)
* Add support for imageRendering

* Make crisp-edges appearance on Firefox more similar to Chrome

* Refactor

* Add background option

* Move data-image-rendering attribute

* Restructure

* Organize

* Add support for appearance

* Update test dictionary

* Update tests
2021-06-06 14:47:48 -04:00
toasted-nutbread
d87515ec12
Translator id updates (#1730)
* Allow unsequenced definitions to be added to multiple groups

* Update translator data to store multiple IDs

* Update Anki note data

* Update test data

* Update docs
2021-06-05 22:27:58 -04:00
toasted-nutbread
41c0132c59
Improve support for sandboxed iframes (#1704)
* Add more tests

* Improve handling of errors from setupFrame

* Passively handle errors when contentDocument is null
2021-05-23 12:29:54 -04:00
toasted-nutbread
ce340d7a19
Update document tests (#1703)
* Update iframe content

* Add srcdoc test
2021-05-23 10:54:28 -04:00
toasted-nutbread
be23acf499
Structured content image size units (#1692)
* Add support for sizeUnits on image content

* Update test data
2021-05-20 19:33:08 -04:00
toasted-nutbread
eddd028864
Add support for definitions with structured content (#1689)
* Add structured content to schema

* Add support for generating custom content

* Update importer

* Update test data

* Add verticalAlign property
2021-05-19 18:24:50 -04:00
toasted-nutbread
ae89a8f2ad
Update test valid dictionaries (#1688)
* Update test data for valid-dictionary1

* Use valid-dictionary1 instead of valid-dictionary2

* Update test data

* Remove test of valid-dictionary2

* Remove valid-dictionary2 data
2021-05-18 19:50:11 -04:00
toasted-nutbread
76276e78da
Expose search query to anki template renderer (#1686)
* Expose query and fullQuery to Anki context

* Add {search-query} marker

* Update test data

* Update tests

* Wrap search query in multiLine
2021-05-17 20:18:37 -04:00
toasted-nutbread
66d048832f
Sentence termination character mode (#1682)
* Change enableTerminationCharacters to terminationCharacterMode

* Update settings

* Update sentence extraction

* Update tests

* Add tests
2021-05-16 15:24:38 -04:00
toasted-nutbread
de6db32aa6
Improve source term exact match count (#1674)
* Update sourceTermExactMatchCount to be based on headword count

* Update tests
2021-05-14 19:26:27 -04:00
toasted-nutbread
289bdc1622
Improve term grouping (#1653)
* Rename _addUniqueStrings to _addUniqueSimple

* Update definition merging to not depend the sequence number

* Improve naming

* Update AnkiNoteDataCreator

* Update docs

* Remove fields that no longer exist

* Update test data
2021-05-08 13:16:56 -04:00
toasted-nutbread
512391346b
Translator alphanumeric improvement (#1635)
* Simplify alphanumeric check

* Update option name for clarity
2021-04-28 21:17:05 -04:00
toasted-nutbread
03dd1dc6ff
Remove redundant dictionary entry sequence (#1618)
* Remove sequence/sequenceDictionary from dictionary entry objects

* Expose isPrimary on definitions

* Update sequence

* Update test data
2021-04-18 18:11:09 -04:00
toasted-nutbread
f9774b4ce9
Improve dictionary sequence info (#1617)
* Ensure negative sequence is always -1

* Expose sequence on definition objects

* Update how sequence is exposed for definitions

* Update test data

* Update TS docs
2021-04-18 18:08:02 -04:00
toasted-nutbread
b8bedd5185
Improve term dictionary entry sequence (#1591)
* Improve sequence for merged entries and add sequenceDictionary

* Update docs

* Expose sequence in definitions

* Expose sequence in root definition

* Update test data
2021-04-03 15:41:44 -04:00
toasted-nutbread
90f7d5ba07
Add part of speech info (#1561)
* Add part of speech info to headwords

* Expose parts of speech to Anki template rendering

* Expose parts of speech

* Update pitch accent categories

* Update docs

* Add part-of-speech

* Update options and tests

* Update markers

* Update test data
2021-03-26 19:50:54 -04:00
toasted-nutbread
4ddd3ec80c
Fix incorrect sorting (#1557)
* Sort by the maximum length of transformedText instead of deinflectedText

* Update docs

* Update tests
2021-03-25 21:40:27 -04:00
toasted-nutbread
4be5c8fd9f
Refactor Translator and dictionary entry format (#1553)
* Update test data

* Move translator.js

* Create new version of Translator

* Update Backend

* Update DictionaryDataUtil

* Update DisplayGenerator

* Create AnkiNoteDataCreator

* Replace AnkiNoteData with AnkiNoteDataCreator

* Update tests

* Remove AnkiNoteData

* Update test data

* Remove translator-old.js

* Add TypeScript interface definitions for the new translator data format
2021-03-25 19:55:31 -04:00
toasted-nutbread
cda04b576d
Update simple test (#1551)
* Test null for simple mode

* Update test data
2021-03-23 22:44:20 -04:00
toasted-nutbread
022154c3e1
Test AnkiNoteBuilder (#1550)
* Add test for AnkiNoteBuilder

* Add test data
2021-03-23 20:54:04 -04:00
toasted-nutbread
89ec1c7572
Remove node data for 'simple' mode, since this is never used (#1538) 2021-03-17 21:55:17 -04:00
toasted-nutbread
f8b2483f0f
Fix incorrect mode in translator test (#1537) 2021-03-17 21:32:55 -04:00
toasted-nutbread
b923e33328
Fix invalid commas in HTML (#1533) 2021-03-15 23:15:21 -04:00
toasted-nutbread
cba45b5e30
Improve translator test data (#1531)
* Organize files

* Split translator test data into two files

* Add test for AnkiNoteData
2021-03-15 20:55:26 -04:00
toasted-nutbread
643dbfb12a
Refactor term frequency data (#1503)
* Add getTermFrequency

* Update DisplayGenerator to use getTermFrequency

* Remove termFrequency from Translator data

* Backwards compatibility

* Update tests
2021-03-07 20:38:40 -05:00
toasted-nutbread
19f6bf5a3a
Refactor furigana segment data (#1502)
* Remove redundant language assignment

* Segment furigana from DisplayGenerator

* Remove furiganaSegments from translator data

* Add backwards compatibility for furiganaSegments

* Update tests
2021-03-07 17:55:51 -05:00
toasted-nutbread
019c8cd4d7
Split dictionary order and index sorting (#1491)
* Refactor expression comparison

* Rename function

* Add dictionary index sorting

* Update test data
2021-03-06 13:04:50 -05:00
toasted-nutbread
b477da97d4
Translator refactor (#1473)
* Refactor _groupTerms and add doc comment

* Update where expression/reading is acquired from

* Add doc comment

* Add isPrimary field

* Update test data

* Add definition which has "isPrimary": false definitions
2021-03-01 19:01:30 -05:00
toasted-nutbread
0decabd768
Improve definition ordering (#1456)
* Update dictionary priority

* Replace dictionaryPriority with dictionaryOrder

* Update tests
2021-02-27 23:11:41 -05:00
toasted-nutbread
e4a4e5f85f
Improve term meta ordering (#1455)
* Update implementation of _buildTermMeta

* Remove old implementation

* Expose dictionaryPriority on frequencies and pitch accents

* Update how meta data is generated; add index

* Update order

* Update names

* Expose expressionIndex as part of pitch/frequency data

* Implement meta sorting

* Update test data
2021-02-27 22:27:00 -05:00
toasted-nutbread
782b945905
Header lint (#1444)
* Add eslint-plugin-header

* Add rule for header format

* Add missing header

* Fix header issues
2021-02-25 20:21:05 -05:00
toasted-nutbread
1e927dd66e
Fix translation regex replacements (#1423)
* Fix regex replacements having issues at the start of scanned text

* Fix test cases

* Add tests
2021-02-19 18:39:43 -05:00