words

How to find mistyping in Arabic and Persian language?

丶灬走出姿态 提交于 2019-12-13 02:49:54
问题 In Persian and Arabic alphabet we have some letters that has different shape but their sounds are so close together. These are list of those letters: S= س, ص, ث Gh= غ , ق T= ت,ط Z= ز , ض, ظ, ذ H= ح , ه Many people don't know how to write words or forget the spelling and write the words wrong. For example for the word دغدغه it can be write in 8 ways: 1: دقدغه 2: دقدغح 3: دقدقه 4: دقدقح 5: دغدغه 6: دغدغح 7: دغدقه 8: دغدقح How can I count how many ways a user can type a word wrong? Is there any

Search for word in text file and display (Ruby)

青春壹個敷衍的年華 提交于 2019-12-13 02:06:54
问题 I'm trying to take input from the user, search through a text file (case insensitively), and then display the match from the file if it matches (with the case of the word in the file). I don't know how to get the word from the file, here's my code: found = 0 words = [] puts "Please enter a word to add to text file" input = gets.chomp #Open text file in read mode File.open("filename", "r+") do |f| f.each do |line| if line.match(/\b#{input}\b/i) puts "#{input} was found in the file." # <--- I

Find semantically similar word for natural language processing

跟風遠走 提交于 2019-12-13 01:07:55
问题 I am working on a natural language processing project in Java. I have a requirement where I want to identify words that belong to similar semantic groups. e.g. : if the words such as study , university , graduate , attend are found I want them to be categorized as being related to education. If words such as golfer , batsman , athlete are found, it should categorize all under a parent like sportsperson. Is there a way I can achieve this task without using and training approach. Is there some

Replace words of text area

自古美人都是妖i 提交于 2019-12-12 19:20:10
问题 I have made a javascript function to replace some words with other words in a text area, but it doesn't work. I have made this: function wordCheck() { var text = document.getElementById("eC").value; var newText = text.replace(/hello/g, '<b>hello</b>'); document.getElementById("eC").innerText = newText; } When I alert the variable newText, the console says that the variable doesn't exist. Can anyone help me? Edit: Now it replace the words, but it replaces it with < b>hello< /b>, but I want to

Can I tell if a std::string represents a number using stringstream?

时间秒杀一切 提交于 2019-12-12 08:34:43
问题 Apparently this is suposed to work in showing if a string is numerical, for example "12.5" == yes, "abc" == no. However I get a no reguardless of the input. std::stringstream ss("2"); double d; ss >> d; if(ss.good()) {std::cout<<"number"<<std::endl;} else {std::cout<<"other"<<std::endl;} 回答1: You should use an istringstream so that it knows it's trying to parse input. Also, just check the result of the extraction directly rather than using good later. #include <sstream> #include <iostream>

Match words of permutations of another word using regex [duplicate]

喜你入骨 提交于 2019-12-12 06:55:57
问题 This question already has answers here : matching all characters in any order in regex (3 answers) Closed 5 years ago . I have a chunk of words, all of which are valid English words I'm going to query with RegExp. What I need is to match words which contains the letters of a specified word in any order. Example (A segment): ... peloton pelt pelta peltae peltast .... I should be able to fill in a regex for "leap" and collect "pelta", "peltae" and "peltast" along with other words within the

Search in Django and GET with multiple words

倖福魔咒の 提交于 2019-12-12 05:43:46
问题 Could you tell me what should I use or where to look if I want to make something like this: When someone types "aaa bbb" (?t=aaa+bbb) in search field, it would only find those models, in which Title field is "aaa bbb", but not "aaa ccc bbb". How to change for example this code to make it find all titles, in which Titles is "aaa" or "bbb" word? if 't' in request.GET: search = request.GET['t'] result = somemodel.objects.filter(Title__icontains = search).order_by('-pub_date') Or in Title are

Javascript - regex - how to remove words with specified length

好久不见. 提交于 2019-12-12 01:36:57
问题 In my case word length is "2" and I am using this regex: text = text.replace(/\b[a-zA-ZΆ-ώἀ-ῼ]{2}\b/g, '') ); but cannot make it work with greek characters. For your convenience here is a demo: text = 'English: the on in to of \n Greek: πως θα το πω'; text = text.replace(/\b[0-9a-zA-ZΆ-ώἀ-ῼ]{2}\b/g, ''); console.log(text); As far as the greek characters are concerned, I try to use a range with 2 sets: "Greek and Coptic" and "Greek Extended" (as seen on unicode-table.com). 回答1: JavaScript has

How can i move words around in a sentence using regex?

陌路散爱 提交于 2019-12-12 01:07:39
问题 So i have the following sentence: "How quickly daft jumping zebras vex." and i need to come up with a single regex expression that will transform that sentence into this: "vex zebras jumping daft quickly How." Can anyone please help me figure this out? 回答1: As mentioned in the comments, regex is not meant for this, since it can't be known how many words there will be. But with your limited example, this works: ^(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\.$ Replace with $6 $5 $4 $3 $2 $1.

Recursively reversing words in a string

◇◆丶佛笑我妖孽 提交于 2019-12-11 18:11:55
问题 My friend got an assignment and I can't help him. Basically, using recursion he needs to print the words of a sentence in the reverse order. For example: Input - This is a sentence Output - sentence a is This Here is an example I wrote him for a normal print, and I could do the whole sentence reversal with no problem, but I can't get neither an idea of a starting point for reversing only the words recursively without a linear approach and using the string library or linked lists or any other