问题描述
大家好!
我试图编写一个搜索程序代码,在那里我将能够用一个用户输入并应显示结果的句子搜索给定的序列列表。也就是说,程序应该能够获得句子中的所有单词并尝试搜索下面的所有单词组合来制作不同的句子并将其与给定的句号相匹配。该句子包含n个单词。
例如,如果我们考虑一个3个单词的句子hello world program,它应该尝试将给定列表与下面给出的以下组合的发送匹配,然后显示匹配的发送结果
Hello world program
Hello program world
世界你好计划
世界节目你好
节目你好世界
节目世界你好
我所知道的是,第一个字保持不变然后是其他所有n -1个单词应该放在不同的位置,然后用任何其他n-1个单词改变第一个单词,剩下的所有单词应该准备剩余的n-1个单词
我需要帮助...有人可以帮助我这个算法提前感谢。
Hi all !!
I was trying to code a search program , where I will be able to search a given list of sentances with one sentence that that the user inputs and should display the results . that is the program should be able to get all the words in the sentence and try searching for all the following word combinationsto make different sentences and match it with the given sentances. Herre the sentence contains n words.
For example if we consider a 3 word sentence "hello world program " it should try and match the given list with the following combinations of the sentances that are given below and then display the result of the matched sentances
Hello world program
Hello program world
World hello program
World program hello
Program hello world
Program world hello
What I know till now is that put the first word is kept constant then all the other n-1 words should be put in different possitions then change first word with any other n-1 word and all the remaining words should accupy the remaining n-1 possitions
I need help… can somebody help me with the algorithm for this thanks a ton in advance.
这篇关于如何从给定的单词中获得不同的句子组合,并在给定的句子列表中搜索它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!