OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 22.2.1
I want to use the textbox to input Chinese characters (which are a composition of two or more letters, and every composed string can refer to any of four or more different characters, which people need to disambiguate by choosing which one is the intended one), but the extra layer of inputting Chinese character is not displayed, although I can choose 1 answer. I looked through previous posts and a solution is using dialogue boxes ( Text responses in python: Input() function and dialogue boxes - #3 by miguel_santin ) . But that doesn’t work very well.
So, is there any way I can input Chinese with the extra layer like the figure?
I’m not very familiar with how typing Chinese characters works, is the box in the screenshot a part of the textbox in the software you’re using or is it something put on the screen by a third party typing software?
The screenshot shows the scene of inputting Chinese characters by a third party typing software, and I want to achieve it in the PsychoPy. The textbox now supports Chinese input, but does not show the extra layer of choosing the right characters that you want to use. As shown in the screenshot, I want to input ‘谢谢’, which mean ‘thanks’, so I need to choose the first answer after I inputted ‘xiexie’, which is the pronunciation of '谢谢‘ ( like the relation of ‘/θæŋks/’ and ‘thanks’). The result of lack of the extra layer is that people couldn’t choose what they want to type correctly.
Ah I see, that makes sense as the PsychoPy Textbox component isn’t the same as a textbox on a website or software interface - so your software won’t recognise it as a text input.
There’s probably a Python package out there which can handle the conversion from ‘xiexie’ to ‘谢谢’, so it’s plausible that you could use Button components or maybe a Slider component to simulate this functionality within an experiment… I’ll look for a suitable package and let you know!
It’s also worth checking pavlovia.org, it’s entirely possible that a member of the community has already made something like this!
I have something which gets some of the way there; the package
dragonmapper allows translation from pinyin to zhuyin, but I’ve not been able to find anything to do pinyin/zhuyin to hanzi. With the help of @suelynnmah I’ve put together a quick demo to show how to implement this within an experiment:
(I made it public so you should be able to find it in the search dialog in Builder and create your own fork, or you can always just click View Code and download the psyexp file)
To run it you need to follow these steps:
to install the
dragonmapper package, and if you can find a Python package with a straightforward pinyin → hanzi function then you can install that via the same process and replace the calls to
dragonmapper in the example, I just couldn’t find anything with my limited knowledge of how the various Chinese scripts work.
Thank you very much for your help. I’ll try it right away.