Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Refactor generate_phrase() to allow for non-SVO languages #8

Open
izzy opened this issue Oct 8, 2017 · 2 comments · May be fixed by #23
Open

Refactor generate_phrase() to allow for non-SVO languages #8

izzy opened this issue Oct 8, 2017 · 2 comments · May be fixed by #23

Comments

@izzy
Copy link
Member

izzy commented Oct 8, 2017

Some languages don't work with the current SVO word ordering used by the generate_phrase function. The function should take another optional argument from wordlist that makes it use a different word ordering.

def generate_phrase(open_status=True):
phrase = choice(WORDLIST[0]) + " "
phrase += choice(WORDLIST[1]) + " "
if open_status:
phrase += choice(WORDLIST[2]) + ". "
else:
phrase += choice(WORDLIST[3]) + ". "
if choice([True, False]):
if open_status:
phrase += choice(WORDLIST[4]).title() + "!"
else:
phrase += choice(WORDLIST[5]).title() + "!"
return phrase

@izzy izzy changed the title Refactor gen_phrase() to allow for non-SVO languages Refactor generate_phrase() to allow for non-SVO languages Oct 9, 2017
@randName
Copy link

randName commented Oct 9, 2017

The way I can see this working is to add a format string to the translations dictionary that determines the order in which the words will be joined.

However, I don't see the pressing need for this change as your sentence at this point is rather simple. In Japanese (the only non-SVO language I personally know), a possible sentence will be "[ Space ] [ は ] [ (営業中|休み中)。 ] [ Extra stuff ]". While there are nuances in exactly which part of the sentence does what, the structure is still pretty similar.

@izzy
Copy link
Member Author

izzy commented Oct 9, 2017

@randName true, most languages actually use the same ordering but there might be other problems like RTL instead of LTR composition, which would make the format string a valuable addition.

@izzy izzy self-assigned this Oct 9, 2017
@izzy izzy linked a pull request Oct 9, 2017 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants