Open craigp-atw opened 3 months ago
Some brainstorming:
A message on a token can include a serializable 'action/change/fix' rule that the client-side will execute if the user accepts it. This means it will have to include indexes and text commands to manipulate tokens.
When a change is applied, it manipulates the tokens. Then it 'textifies' the tokens and changes the text within the text area. Then it may or may not resubmit the text for checking.
Potential example rules/actions:
'missing bracket before a subordinate clause' (existing rule)
{
...(triggered on the relativizer)
'error': {
'message': '...',
'precededby': '[',
'change': {
'action': 'insert_before',
'index': '{trigger}', // gets converted to a number before being serialized
'text': '[',
},
},
}
Use "We(X) Verb _suggestiveLets" instead of "Let's Verb"
{
...(triggered on "Let's", Verb in context)
'error': {
'message': '...',
'precededby': '[',
'change': [ // multiple actions for the same change
{
'action': 'replace',
'index': '{trigger}',
'text': 'We(X)',
},
{
'action': 'insert_after',
'index': '{context:0}',
'text': '_suggestiveLets',
},
],
},
}
use 'each-other', not 'each other'
{
...(triggered on 'each', context is 'other')
'error': {
'message': '...',
'change': [
{
'action': 'replace',
'index': '{trigger}',
'text': 'each-other',
},
{
'action': 'delete',
'index': '{context:0}',
},
],
},
}
Suggest 'at that place' instead of 'there'
{
...(triggered on 'there')
'error': {
'change': [
{
'action': 'replace',
'index': '{trigger}',
'text': 'at that place',
},
],
},
}
remove 'that' as a complementizer
{
...(triggered on clause, 'that' is subtoken context)
'error': {
'precededby': '[',
'change': [ // multiple actions for the same change
{
'action': 'delete',
'index': '{subtokens:0}', // unsure how this would be handled
},
],
},
}
Some errors or suggestions are simple enough that the user can click 'accept' and the text will update accordingly. There could also potentially be a 'fix all' button. It's impossible to auto-fix everything (for example a pronoun referent), but it would make some things easier (like adding/removing a sense).