Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split sentence into array of arrays of syllables of each word #28

Closed
Vicedivic opened this issue Dec 1, 2018 · 19 comments
Closed

Split sentence into array of arrays of syllables of each word #28

Vicedivic opened this issue Dec 1, 2018 · 19 comments

Comments

@Vicedivic
Copy link

Hi Van der Lee,

Is it possible for any of your functions to return an array of arrays of syllables of each word?

Example: "I am working".
Output:

array(

    0 => array(

        0 => "I"

    ), 

    1 => array(

        0 => "am"

    ), 

    2 => array(

        0 => "work", 

        1 => "ing"

    )

);

@vanderlee
Copy link
Owner

Good idea, but currently not available.

It should be quite possible to add a splitWords(string $text) method that outputs an array of split words. Punctuation, numbers, spacing and other non-words would (optionally) have to appear in their own root elements, but that shouldn't be much of a problem.

If you'd like to contribute such a method, it would be highly appreciated. Otherwise it might take a while for me to get to it, as I'm currently focussing on different projects.

@Vicedivic
Copy link
Author

Yeah, sure

@Vicedivic
Copy link
Author

How do I get write permission?

@vanderlee
Copy link
Owner

Just submit a pull request from your forked repository through Github.

@Vicedivic
Copy link
Author

I've made a function that works without symbols now, but I would probably need some help to make it work with symbols

@Vicedivic
Copy link
Author

I also added a testSplitWords() function in SyllableTest.php

@Vicedivic
Copy link
Author

When I try to push the changes to my fork, it says that I don't have permission to do that:

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

@vanderlee
Copy link
Owner

Thanks for the effort! The error is probably either a wrong repository name (you have to push to your own fork, not this main repository) or you have not set your public key (I'm assuming this is not the case, considering what you wrote earlier).

Please let me know if this is getting too much work for you, and we could just copy+paste the code but if you want to contribute to other github projects in the future, the process will be the same.

@Vicedivic
Copy link
Author

Vicedivic commented Dec 26, 2018

I haven't worked that much with Git, so I would like to learn how the process works 😄
I just have to understand the process: So I start by pushing the changes to my own fork and then create a pull request to your repository?
Ps: I haven't created a public key, could that be the case?

@vanderlee
Copy link
Owner

Exactly right! With Git, you basically only work directly with your own repository and create pull requests. Github manages the pull requests (PR's) and makes it easy to work this way.

@Vicedivic
Copy link
Author

So the only problem is that I don't have permission to push to my own fork. Does this have anything to do with the public key that I haven't set?

@vanderlee
Copy link
Owner

Very likely. You'll need to set up a private/public key pair, install the private key locally and upload the public key pair to github.

@Vicedivic
Copy link
Author

Is this the same as an SSH key or deploy key?

@vanderlee
Copy link
Owner

Yes, the SSH key

@Vicedivic
Copy link
Author

I've created a pull request now 😄

@vanderlee
Copy link
Owner

$syllables = explode('-', $string);

That doesn't take into account word boundaries or hyphens already in the text.

@alexander-nitsche
Copy link
Collaborator

PR #30 is probably related to related to this issue. The PR had been approved but not merged: is there anything missing?

@vanderlee
Copy link
Owner

PR #30 has some merge conflicts. I'm pretty short on time at the moment but will try to take a look at it next week.

@alexander-nitsche
Copy link
Collaborator

Hi @Vicedivic ,

to understand your use case in general and specifically: What do you expect should be returned by splitWords(string $text) for the text "Redundant, punctuation..."? This:

[
  ['Re', 'dun', 'dant'],
  [', '],
  ['punc', 'tu', 'a', 'tion'],
  ['...'],
],

?

How should punctuations be handled?

Greetings
Alex

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

No branches or pull requests

3 participants