Any idea on how I would be able to do a search within C# that does
ranges or words
For example
I want to search for Chicken in the string
string s1 = "This is Great Chicken";
string s2 = "Chicken";
return s1.IndexOf(s2) >= 0
The trick is how would I search for: Person doing the search
misspelled the word Chickin (Happens all the time);
string s1 = "This is Great Chicken";
string s2 = "Chickin";
return ???
or
Worst yet
string s1 = "This is Great Chickin";
string s2 = "Chicken";
Person enter the search phrase misspelled the word Chicken;
string s1 = "This is Great Chickin";
string s2 = "Chicken"; 14 2980
On Oct 2, 2:26*pm, S <scottremi...@y ahoo.comwrote:
Any idea on how I would be able to do a search within C# that does
ranges or words
For example
I want to search for Chicken in the string
string s1 = "This is Great Chicken";
string s2 = "Chicken";
return s1.IndexOf(s2) >= 0
The trick is how would I search for: Person doing the search
misspelled the word Chickin (Happens all the time);
string s1 = "This is Great Chicken";
string s2 = "Chickin";
return ???
or
Worst yet
string s1 = "This is Great Chickin";
string s2 = "Chicken";
Person enter the search phrase misspelled the word Chicken;
string s1 = "This is Great Chickin";
string s2 = "Chicken";
Check out the Regex namespace.
If you search something such as "Chickin" in a string which does not
contain this token, such as "This is Great Chicken", what would you
expect to return? I wouldn't expect it to return anything. Maybe you
wanna do something like google's key words suggestion if user entry
has some typos?
On Oct 2, 2:51*pm, Author <gnewsgr...@gma il.comwrote:
On Oct 2, 2:26*pm, S <scottremi...@y ahoo.comwrote:
Any idea on how I would be able to do a search within C# that does
ranges or words
For example
I want to search for Chicken in the string
string s1 = "This is Great Chicken";
string s2 = "Chicken";
return s1.IndexOf(s2) >= 0
The trick is how would I search for: Person doing the search
misspelled the word Chickin (Happens all the time);
string s1 = "This is Great Chicken";
string s2 = "Chickin";
return ???
or
Worst yet
string s1 = "This is Great Chickin";
string s2 = "Chicken";
Person enter the search phrase misspelled the word Chicken;
string s1 = "This is Great Chickin";
string s2 = "Chicken";
Check out the Regex namespace.
Correction: I meant the System.Text.Reg ularExpressions Namespace http://msdn.microsoft.com/en-us/libr...pressions.aspx
Regex is a class of this namespace.
If you search something such as "Chickin" in a string which does not
contain this token, such as "This is Great Chicken", what would you
expect to return? *I wouldn't expect it to return anything. *Maybe you
wanna do something like google's key words suggestion if user entry
has some typos?
On Thu, 02 Oct 2008 11:26:38 -0700, S <sc**********@y ahoo.comwrote:
Any idea on how I would be able to do a search within C# that does
ranges or words
There are a variety of techniques for dealing with partial matching as you
describe.
I've actually implemented a very simple approach myself in the past, in
which I do a sort of character-by-character merge between the target text
and the search word, finding the spot in the target text where the search
word fits the best with the least number of excluded characters. This
would work perfectly for the examples you gave, but whether that would
address your more general goals I can't say.
If that sounds promising, I might be able to dig up the code and post it
here. It's pretty inefficient, but it's small and simple so what the
heck? :)
You might also Google for "soundex". There's even a Wikipedia article on
the topic: http://en.wikipedia.org/wiki/Soundex
That's a commonly used technique for matching words based on phonetics and
if you want a solution that is based more on language than on typography,
it might be a better approach.
A Google search on "dictionary spell check algorithm" also turned up a
number of promising links.
Pete
On Oct 2, 2:26 pm, S <scottremi...@y ahoo.comwrote:
Any idea on how I would be able to do a search within C# that does
ranges or words
For example
I want to search for Chicken in the string
string s1 = "This is Great Chicken";
string s2 = "Chicken";
return s1.IndexOf(s2) >= 0
The trick is how would I search for: Person doing the search
misspelled the word Chickin (Happens all the time);
string s1 = "This is Great Chicken";
string s2 = "Chickin";
return ???
or
Worst yet
string s1 = "This is Great Chickin";
string s2 = "Chicken";
Person enter the search phrase misspelled the word Chicken;
string s1 = "This is Great Chickin";
string s2 = "Chicken";
Hi,
I do not how to do it in code, I'm pretty sure that no version of the
framework provides such a feature.
In T-SQL you have this feature though take a look for SOUNDEX function
On Oct 2, 2:51 pm, Author <gnewsgr...@gma il.comwrote:
On Oct 2, 2:26 pm, S <scottremi...@y ahoo.comwrote:
Any idea on how I would be able to do a search within C# that does
ranges or words
For example
I want to search for Chicken in the string
string s1 = "This is Great Chicken";
string s2 = "Chicken";
return s1.IndexOf(s2) >= 0
The trick is how would I search for: Person doing the search
misspelled the word Chickin (Happens all the time);
string s1 = "This is Great Chicken";
string s2 = "Chickin";
return ???
or
Worst yet
string s1 = "This is Great Chickin";
string s2 = "Chicken";
Person enter the search phrase misspelled the word Chicken;
string s1 = "This is Great Chickin";
string s2 = "Chicken";
Check out the Regex namespace.
If you search something such as "Chickin" in a string which does not
contain this token, such as "This is Great Chicken", what would you
expect to return? I wouldn't expect it to return anything. Maybe you
wanna do something like google's key words suggestion if user entry
has some typos?
I do not know how to use a Regex in this case.can you elaborate?
"S" <sc**********@y ahoo.comwrote in message
news:de******** *************** ***********@64g 2000hsm.googleg roups.com...
The trick is how would I search for: Person doing the search
misspelled the word Chickin (Happens all the time);
The answer is that what you're looking for is not at all simple. I'd
recommend you do a Google search to see if you can find sample code for a
spell checker.
Jeff Johnson kirjoitti:
"S" <sc**********@y ahoo.comwrote in message
news:de******** *************** ***********@64g 2000hsm.googleg roups.com...
>The trick is how would I search for: Person doing the search misspelled the word Chickin (Happens all the time);
The answer is that what you're looking for is not at all simple. I'd
recommend you do a Google search to see if you can find sample code for a
spell checker.
Spelling checker does not help. For example the text contains "Cut" and
the user searches for "Cat". Both are spelled right, so the search gives
no result.
But, with addition to already mentioned Soundex, you might like to check
Levenshtein distance
( http://en.wikipedia.org/wiki/Levenshtein_distance). It tells how
similar two texts are; i.e. how many simple edit commands are needed to
make the second text from the first. For example distance between
Chicken and Chikin is one.
About Soundex: I have not studied it much, but I have a feeling Knuth
built it for english words. How well does it apply to other languages
or names?
-
Arto Viitanen
"Arto Viitanen" <ar***********@ microteam.fiwro te in message
news:48******** *************** @news.tdc.fi...
>>The trick is how would I search for: Person doing the search misspelled the word Chickin (Happens all the time);
The answer is that what you're looking for is not at all simple. I'd recommend you do a Google search to see if you can find sample code for a spell checker.
Spelling checker does not help. For example the text contains "Cut" and
the user searches for "Cat". Both are spelled right, so the search gives
no result.
I agree, IF you say, "Hey, Mr. Spell Checker algorithm, tell me what's
misspelled in this sentence." However, if you are in control of the code,
I'd think you'd be able to say, "Hey, Mr. Spell Checker algorithm, make a
list of all the probable misspellings of 'chicken' and tell me if this
string contains any of them." See where I'm going?
But, with addition to already mentioned Soundex, you might like to check
Levenshtein distance
(http://en.wikipedia.org/wiki/Levenshtein_distance). It tells how
similar two texts are; i.e. how many simple edit commands are needed to
make the second text from the first. For example distance between
Chicken and Chikin is one.
Sounds good.
About Soundex: I have not studied it much, but I have a feeling Knuth
built it for english words. How well does it apply to other languages
or names?
I've heard people say that Soundex is an ancient crutch and shouldn't be
relied upon too much.
Peter Duniho wrote:
On Thu, 02 Oct 2008 11:26:38 -0700, S <sc**********@y ahoo.comwrote:
>Any idea on how I would be able to do a search within C# that does ranges or words
There are a variety of techniques for dealing with partial matching as
you describe.
I've actually implemented a very simple approach myself in the past, in
which I do a sort of character-by-character merge between the target
text and the search word, finding the spot in the target text where the
search word fits the best with the least number of excluded characters.
This would work perfectly for the examples you gave, but whether that
would address your more general goals I can't say.
[SNIP]
Pete
That sounds interesting. Is there any chance of seeing it as a
CodeProject article? :D This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Anand Pillai |
last post by:
To search a word in a group of words, say a paragraph or a web page,
would a string search or a regexp search be faster?
The string search would of course be,
if str.find(substr) != -1:
domything()
And the regexp search assuming no case restriction would be,
|
by: Ken Fine |
last post by:
I'm looking to find or create an ASP script that will take a string, examine
it for a search term, and if it finds the search term in the string, return
the highlighted search term along with the words that surround it. In other
words, I want the search term highlighted and shown in an excerpt of the
context in which it appears.
Any suggestions or pointers? This behavior is most often seen as part of a
search engine. In my case, I want...
|
by: Phlip |
last post by:
C++ers:
Here's an open ended STL question. What's the smarmiest most templated way
to use <string>, <algorithms> etc. to turn this:
" able search baker search charlie "
into this:
" able replace baker replace charlie "
|
by: tshad |
last post by:
Can you do a search for more that one string in another string?
Something like:
someString.IndexOf("something1","something2","something3",0)
or would you have to do something like:
if ((someString.IndexOf("something1",0) >= 0) ||
((someString.IndexOf("something2",0) >= 0) ||
|
by: Hriday |
last post by:
Hi there,
I am working on a web application in ASP.NET
My web server and AD machine are in the same domain but
located on diffrent phisical machine, I am not able to
search user's info by the following code if I pass only
path as parameter to DirectoyEntry class. The same code is
working if I pass all the three parameter as path,userId
and password. but I have to use windows authenticatoin and
can't get password from Windows...
| |
by: Eric |
last post by:
Hi: I have two files. I search pattern ":" from emails text file and
save email contents into a database. Another search pattern " field is blank. Please try again.",
vbExclamation + vbOKOnly
Me.txtEmail.SetFocus
Exit Sub
End If
Me.txtStatusBar.Value = "Parsing..."
strEmail = Me.txtEmail.Value
|
by: BenCoo |
last post by:
Hello,
In a Binary Search Tree I get the error : Object must be of type String
if I run the form only with the "Dim bstLidnummer As New BinarySearchTree"
it works fine.
Thanks for any help on this,
Benny
|
by: |
last post by:
I have a question about spawning and displaying subordinate list controls
within a list control. I'm also interested in feedback about the design of
my search application. Lots of code is at the end of this message, but I
will start with an overview of the problem.
I've made a content management solution for my work with a decently
structured relational database system. The CMS stores articles. The CMS also
stores related items --...
|
by: JamesOo |
last post by:
I have the code below, but I need to make it searchable in query table,
below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only, cannot serch by combine 3 table)
Example I have the query table below, how do I make the code to seach based on the query from this:
SELECT Product.ID, Product.Description, Quantity.Quantity, Quantity.SeialNo, Quantity.SupplierID,...
|
by: Debadatta Mishra |
last post by:
Introduction
In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |