Icon

justknimeit-34 - Word Scramble

justknimeit-34 - Word Scramble
Challenge 34: Word ScrambleLevel: MediumDescription: One of your tasks at work is to train a model using sentences with the correct wordcontext (i.e., words in a sentence following a meaningful and correct order). However, to trainsuch model, you also need to create a dataset of words used in an incorrect context. You canthink of this task as a version of Negative Sampling - a neat technique for training the famousWord2Vec model. Concretely, in this challenge you will create a workflow that takes a sentenceand scrambles the order of its words. You can create a small sample of sentences to test yourwork with the Table Creator node.InputI like cats.Outputcats. like IHint: Our simple solution only uses 5 nodes, but the permutations are not exactly random.Conversely, our more complex solution uses more than 15 nodes and 2 loops, as well as theRandom Numbers Generator node, to create truly scrambled sentences. Bonus: Create asolution with true randomization without using any loops. Simplest solution - 5 nodes only but all sentences randomised in a similar manner (same reordering),hence pseudoscrambled sentences Loop-based solution - Using the loop to randomise each sentence in its unique manner Another loop-based solution with Random Numbers Generator node - each sentence is scrambled individually in a unique random manner, by assigning a random number to each wordand rearranging them in a numerical sequence Loop-free 'true randomisation' method - Combining all words in all sentences (whilst retaining information on the sentence source) in a single column, then shuffling all rowswithin the singular column. Group the column based on the original sentence source, creating the list of scrambled words. Based on the assumption that randomness is stillpreserved when certain elements are subsetted from the whole which already contains randomness. Sample textSplit sentences into wordsTransposeStart column list loopGenerate random numbers with max and number of values defined by the number of rowsTransposeUnpivots the table into a single column, each word has its own rowID and position associated with itShuffles all the rowsGroups all the scrambled words into a list, based on the row number (i.e. sentence order)Splits the list into columns of wordsAggregates the rows into a scrambled sentenceSplit sentences into wordsSample textSample textSplit sentences into wordsTransposeShuffle the rows (affects all columns at the same time)TransposeAggregates the rows into a scrambled sentenceTransposeStart column list loopSample textShuffle rows for each columnTransposeAggregates the rows into a scrambled sentenceEnds loopSplit sentences into wordsExtract table dimensionFilters empty rows if anyConverts to variableGenerate counters for each rowReplaces random numbers with wordsAggregates the rows into a scrambled sentenceTransposeEnds loopCreates a column of integer row numbers (relating to the sentence order)Filters unwanted column Table Creator Cell Splitter Transpose Column ListLoop Start Random NumbersGenerator Transpose Unpivoting Shuffle GroupBy Split CollectionColumn Column Aggregator Cell Splitter Table Creator Table Creator Cell Splitter Transpose Shuffle Transpose Column Aggregator Transpose Column ListLoop Start Table Creator Shuffle Transpose Column Aggregator Loop End Cell Splitter Extract TableDimension Row Filter Table Columnto Variable Counter Generation Cell Replacer Column Aggregator Transpose Loop End Cell Splitter Column Filter Challenge 34: Word ScrambleLevel: MediumDescription: One of your tasks at work is to train a model using sentences with the correct wordcontext (i.e., words in a sentence following a meaningful and correct order). However, to trainsuch model, you also need to create a dataset of words used in an incorrect context. You canthink of this task as a version of Negative Sampling - a neat technique for training the famousWord2Vec model. Concretely, in this challenge you will create a workflow that takes a sentenceand scrambles the order of its words. You can create a small sample of sentences to test yourwork with the Table Creator node.InputI like cats.Outputcats. like IHint: Our simple solution only uses 5 nodes, but the permutations are not exactly random.Conversely, our more complex solution uses more than 15 nodes and 2 loops, as well as theRandom Numbers Generator node, to create truly scrambled sentences. Bonus: Create asolution with true randomization without using any loops. Simplest solution - 5 nodes only but all sentences randomised in a similar manner (same reordering),hence pseudoscrambled sentences Loop-based solution - Using the loop to randomise each sentence in its unique manner Another loop-based solution with Random Numbers Generator node - each sentence is scrambled individually in a unique random manner, by assigning a random number to each wordand rearranging them in a numerical sequence Loop-free 'true randomisation' method - Combining all words in all sentences (whilst retaining information on the sentence source) in a single column, then shuffling all rowswithin the singular column. Group the column based on the original sentence source, creating the list of scrambled words. Based on the assumption that randomness is stillpreserved when certain elements are subsetted from the whole which already contains randomness. Sample textSplit sentences into wordsTransposeStart column list loopGenerate random numbers with max and number of values defined by the number of rowsTransposeUnpivots the table into a single column, each word has its own rowID and position associated with itShuffles all the rowsGroups all the scrambled words into a list, based on the row number (i.e. sentence order)Splits the list into columns of wordsAggregates the rows into a scrambled sentenceSplit sentences into wordsSample textSample textSplit sentences into wordsTransposeShuffle the rows (affects all columns at the same time)TransposeAggregates the rows into a scrambled sentenceTransposeStart column list loopSample textShuffle rows for each columnTransposeAggregates the rows into a scrambled sentenceEnds loopSplit sentences into wordsExtract table dimensionFilters empty rows if anyConverts to variableGenerate counters for each rowReplaces random numbers with wordsAggregates the rows into a scrambled sentenceTransposeEnds loopCreates a column of integer row numbers (relating to the sentence order)Filters unwanted column Table Creator Cell Splitter Transpose Column ListLoop Start Random NumbersGenerator Transpose Unpivoting Shuffle GroupBy Split CollectionColumn Column Aggregator Cell Splitter Table Creator Table Creator Cell Splitter Transpose Shuffle Transpose Column Aggregator Transpose Column ListLoop Start Table Creator Shuffle Transpose Column Aggregator Loop End Cell Splitter Extract TableDimension Row Filter Table Columnto Variable Counter Generation Cell Replacer Column Aggregator Transpose Loop End Cell Splitter Column Filter

Nodes

Extensions

Links