Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

"enumeration-like" transcribe tool #571

Open
gr- opened this issue Feb 18, 2016 · 4 comments
Open

"enumeration-like" transcribe tool #571

gr- opened this issue Feb 18, 2016 · 4 comments

Comments

@gr-
Copy link

gr- commented Feb 18, 2016

Is there any way to provide with completion from a finite set of predefined values (e.g. list of author names) as a transcription tool? Ultimately, it would also be possible to add new entries on the fly. It would greatly help the user to converge to the right transcription in many situations.

@gr-
Copy link
Author

gr- commented Mar 2, 2016

investigating "suggest" feature... work in progress

@tufixm
Copy link

tufixm commented Mar 15, 2016

Hey, I wonder if you have any comments after your investigation about the "suggest" feature. I'd also be interested in using it. Cheers!

@gr-
Copy link
Author

gr- commented Mar 22, 2016

Once again, most of the required development has been done beforehand.
Actually, I (almost) only substituted the following nightmarish piece of code:

    if ! tool_config.nil? && ! tool_config['options'].nil? && tool_config['options'].respond_to?('each') && ! (subtool_index = tool_config['options'].find_index { |h| (! h['value'].nil?) && h['value'].to_s == field_name }).nil?
      tool_config['options'][subtool_index]['tool_config']
    else
      tool_config
    end

to the existing one in the tool_config_for_field method of the models/workflow_task.rb file. The key point is that options are arrays rather than hashes (don't know why). This code allows for indexing terms (at least for me) and then retrieving suggestions as soon as you ask for ('suggest'='common').

It is probably straightforward to retrieve suggestions from a url (let say, a separate database document), since you have only to provide with a new basic model (like term), populate it (by hand?), declare a new route (like the one for classifications#terms) and glue the pieces of the puzzle like for the common strategy.

@tufixm
Copy link

tufixm commented Mar 22, 2016

Thank you for this!
I needed to use only the arrays option and I did some hacking of my own inside app/assets/javascript/components/transcribe/tools/text-tool/index.cjsx

I'll post a bit later what I did.
This is such a useful project, pity that the sources are not well documented.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants