- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a string column named "Column_Test" which cotains text up to 200 characters.
I want to identify those rows/ids where "Column_Test" value has 5 or more consonants without vowel.
Could anyone help me on this ?
Thanks
Nikunj
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Load the column into an array, looping one character at a time. Then, count the members of the array that you consider consonants.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hope this helps:
data have;
input Column_Test $50.;
datalines;
ABCEDIFOGUHJKLMNPQRSTVXZ
;
data want;
set have;
want=length((compress(Column_Test,'AEIOU','L')));
if want>5 then put '5 or more consonants without vowel';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Use the COUNTC function to find if there are voewls. Then use length to count the length of the string;
data want;
y = 'dfktbcpl';
nvowels=countc(y,'aeiouy');
length=length(y);
run;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How will you decide whether the letter "Y" is a vowel or not?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Objective is to find mistyping
Ex -
looking more for things like strkct instead of strict
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So for the exceptions, like "strengths" you are willing to inspect them to see if they are valid? (You still need to decide whether "Y" qualifies as a vowel. Is "tryst" a valid word or a mis-spelling? How about "encrypts"?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you were correct. 'Y' should also be included as vowel.
I have included 'Y' in my solution. I have posted the solution too in one of the comment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Spaces? Punctuation? Special Characters such as @#$%^&*()_-=+.
Is this supposed to be contiguous consonants or to the above not "reset" the count.
Might want to provide some concrete examples and whether they meet the requirement or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Objective is to find mistyping
Ex -
looking more for things like strkct instead of strict
Yes, we have to reset the counter once it got vowel in the string and again start counting.
We have to ignore spaces, punctuation and special character.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
There used to be a dictionary or spelling procedure. I don't know if it still exists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think you're better off doing a dictionary search. You can find lists online. Flag anything not a valid word and then build your rules from there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here we are not looking for a correct word but a mistyped word. Text
contains various places name too that are not a part of dictionary word.
We just want to capture those rows which has more than five consonants
appearing in a string continuously.
Then, we will manually review whether it is mistyped or not.
I Hope I am able explain my question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So a mistyped word will not end up in the list and then you can check it...am I missing something?
What defines a 'mistyped' word is your actual problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So, to capture mistyped word we came up with a logic that any word which
doesn't have vowels in it could be mistyped.
On the top of that we added that if the count of consonants(continuous)
should be greater than 5 or more then only we call them mistyped.
*This column contains addresses.