0

I am currently trying to utilize an input, an output, with vowels and numbers.

If I input any word, then based on the vowels a, e, i, o, u, along with calculating every possible output from the given info, the program spits out every combo.

Example of process:

User inputs the word "cat" Program takes every vowel (aeiou) and creates permutations that look like: "ct cat cet cit cot cut" ("ct" with no vowel at all for various reasons) Then compare each word to DictionaryList (which I already have set up) and remove any entries that are misspelled. So how would I go about taking the dynamically generated input from the user (the word cat), detecting all instances of vowels in the input (cAt) and outputting all available combos? Sounds simple at first, but suppose the word "abomination" is plugged in.

Example of code I'm using:

'This is the Function I found online (link at bottom)
Private Function CartesianProduct(Of T)(ParamArray Sequences As T()()) As T()()
    Dim Result As IEnumerable(Of T()) = {New T() {}}
    Dim Var As String() = {}
    For Each Sequence In Sequences
        Dim S = Sequence
        Result = From Seq In Result
                 From Item In S
                 Select Seq.Concat({Item}).ToArray()
    Next
    Return Result.ToArray()
End Function

'These 2 pieces are the vowels and numbers:
Dim S1 As String() = New String() {"", "a", "e", "i", "o", "u"}
Dim S2 As String() = New String() {"1", "2"}

'Permutation Operation:
Dim SS As String()() = CartesianProduct(S1, S2)

'Create the Output
Dim Output As String = Nothing

'Combine both Inputs
For i = 0 To SS.GetLength(0) - 1
    Output = Output & Join(SS(i)).Replace(" ", Nothing) & " "
Next

MsgBox(Output)

So basically, how can I properly use the input with the permutation to replace all vowels from within the input and give me an output? Thank you for whoever can solve this!!! You are saving me from brain strain!!!

Link to Permutations

PS: The second string, S2, is for numerics, I need it because I need to calculate the above SS string scenerio, not just any S1 or S2).

PPS: Here is a diagram: Diagram of 2 dimensions of permutation

Community
  • 1
  • 1
  • What you want is more restrictive than a normal permutation. ACT for instance is a valid permutation but it isnt a valid vowel replacement combo – Ňɏssa Pøngjǣrdenlarp Oct 02 '16 at 21:47
  • @Plutonix I also forgot to mention I need it in a specific order. – Jacky Doban Oct 02 '16 at 21:49
  • Think of a slot machine, the C and T are stuck, but the vowels are spinning. – Jacky Doban Oct 02 '16 at 21:49
  • I know. I understood the post. I was explaining why a normal permutation wont work - the C and the T are not stuck. ACT will come up which you dont seem to want – Ňɏssa Pøngjǣrdenlarp Oct 02 '16 at 21:52
  • So, is there a way I can have the input string come in, and go to each character that's a vowel and combo up? I'm just very perplexed as this is a very specific formula which I have almost no iota in understanding. – Jacky Doban Oct 02 '16 at 21:54
  • Perhaps, get the index of first vowel inside input: then save the characters up until that point to another string called "Chunk1". Then Continue the same and stop for "Chunk2". Etc, etc until the end. Then with the chunks set aside, get every combo of the vowels, then use that total number and plug each chunk back in? – Jacky Doban Oct 02 '16 at 21:57

0 Answers0