|
Hi all,
I have sat on the sidelines reading all your posts for a long time now. Up until now I have managed to hack my way through my own solutions by trial and error and looking here but now, i am a little lost for a solution to my current problem. Here is what i want to do.
Using C#
I have a word table sorted in order of the 1000 most commonly used words in the English language.
I want to read in from a text file, such as an Ebook or the likes and for each word read, store the numeric value representing its position in the lookup table in a tree like structure. I dont want to repeat words in the same depth in the tree, but realise they will be repeated at a later depth in the tree.
As i read in each sentence from the file, i want to check from the existing entries in the tree to see if the word exists.
In the case of a new start to a sentence I want to create a new root node and build on it accordingly, in the case of the begginings of the sentence
already being stored I only want to branch when a new word (and thus a new possible sentence path) is found.
that way any random sentence in the book could be recreated by traversing the tree by following the correct branches to the final child node.
I thought using the lookup table and storing ints would be a little more resource friendly rather than strings of words for each element.
So saving the following sentences would look like this...
The Boy Fell In the Mud
The Boy Fell In the Sand
The Boy Fell In the Water
The Boy Got Up Quickly
The Boy Got Up Slowly
The Boy Got Up To a lot of Mischief
The Boy Got Up To no good
The Girl....
Once upon a time...
Stores 2 dimensionally like this
The-Boy-Fell-In-the-Mud
-------------------------Sand
-------------------------Water
------------Got-Up-Quickly
------------Got-Up-Slowly
----------------------To-a-lot-of-Mischief
----------------------To-no-good
The Girl...
Once Upon a time...
Now to the question, I have been trying this using lists of lists but boy it is getting muddy.
I had a look at just using arrays but could not really work out how to do this effectively.
Considered hashtables??
So the question is, how would you guys approach this, create a class of some sort, persevere with the list of lists.
I confess I am a little lost at this point.
Any suggestions would be greatly appreciated.
Thanks heaps
Ray
|
|
|
|
|
Member 456249 wrote: I dont want to repeat words in the same depth in the tree, but realise they will be repeated at a later depth in the tree.
How about a treeview? I'm suggesting a visual component, because it might help in debugging, and it seems like the data would fit nicely.
I are Troll
|
|
|
|
|
I did have a bit of a fiddle with treeview, I suppose I could serialize it and write and read it back and forth as needed. I guess i was looking at it as more a visual thing, rather than a practical storage method? It might be interesting to visualise it that way now that I think about it. I might give that a shot. Thanks for that. Sometimes I miss the obvious and spend time on the obscure
|
|
|
|
|
Proffessor Lidenbrock wrote: I guess i was looking at it as more a visual thing, rather than a practical storage method?
That's how it's intended, yes. Alternatively, you could create your own tree-structure, kinda like this;
class MyWordNode
{
MyWordNode parent;
List<MyWordNode> children;
}
Start of with a rootnode (one with null as a parent). If you want to add a child to that node, add it to the list of children. That new node will also have it's own list of children, giving you a tree.
Abusing a treeview will save the time of writing your own tree
I are Troll
|
|
|
|
|
Hehe thanks, i like that, abusing treeview
Well since your first post I have made some progress. I have a tree that I can click and add and remove nodes. I have a loaded up the word list and have read into a normal listview the text file, making one sentence one item, removing all punctuation and non char entries.
Just tried to impliment a search threough the nodes of the treeview but crashed and burned on the first attempt. It is nearly 1 am. will try again tommorow. Thanks heaps.
|
|
|
|
|
Cool - you're welcome
|
|
|
|
|
How do you handle:
The boy threw the ball.
The boy threw the ball and the dog fetched it.
This seems to be similar to the spell check tree[^] that I had to write in college.
|
|
|
|
|
Just had a look at that then, a Patricia tree??? Not sure what to think of that one?
|
|
|
|
|
hi
i standing in any position, i need to know if i'am in radius of 10 m from 32.226743,34.747009 position
how to do it ?
(i work on C# windows-mobile)
thank's in advance
|
|
|
|
|
You want to know what classes to use or how to calculate it?
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
|
Hi,
You can use google API to find out the lattitude ,longitude of user current position. Then use the mathimatical formula to find out the distance.
Thanks
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|
|
|
DONE-Problem Resolved
Hi all,
I am createing msi package of my application. If the msi package already install on the system then automatically it should uninstall the previous version and install the new version.
Can anybody help me how can i do this?
Regards
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
modified on Monday, July 26, 2010 4:50 AM
|
|
|
|
|
right Click on the setup project and click uninstall
|
|
|
|
|
Hi,
Is it possible to integrate LightBox popup in Windows Application.
Thanx
krishna
|
|
|
|
|
if you're working from a webpage I would integrate a webcontrol into the winapp.
If you're working from winforms, first idea that comes to mind is working with 2 panels. 1 semi transparent that will partially hide the application, the second with the contents you need. You can hide/unhide when necessary. (For reusability, make a User Control)
hope this helps.
V.
|
|
|
|
|
Hi,
Do u have any web links that i can refer ???
krishna
|
|
|
|
|
|
Hi,
We are having a web application which is quite big and used by around 300 super users for managing around 5000 staffs.
Now we are implementing SMS functionality into the application which means the users will be able to send and recieve sms. Every two minute the sms server of the third party is pinged to check whether there are any new messages. Also sms are hold in queue and send every time interval of 15 to 30 minutes.
I want this checking and sending process to run in the background of the application all the time, even if the user closes the browser window.
I need some advice on how do i do this ?
Will using thread will achieve this or do I need to create a windows service for it or are there any other options ?
Regards
Vinay
|
|
|
|
|
I guess you use some DB to store this SMS info, then Windows Service will do the job.
|
|
|
|
|
i have a text box which has set visible false
i want as when as i click on check box then that text field should be enable without post-back (or reload page)
how is that possible please help me..
|
|
|
|
|
look into clients side script like javascript or vbscript.
V.
|
|
|
|
|
ok
if i am using update panel and set check box auto post back true still check box is not working
how it will work??
asp code
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<td align="left" colspan="4"><asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"
oncheckedchanged="CheckBox1_CheckedChanged1" />
<br />
<asp:TextBox ID="TextBox1" runat="server" visible ="false"></asp:TextBox>
<br />
</ContentTemplate>
</asp:UpdatePanel>
server side
protected void CheckBox1_CheckedChanged1(object sender, EventArgs e)
{
if (CheckBox1.Checked==true)
{
TextBox1.Visible = true;
}
if (CheckBox1.Checked==false)
{
TextBox1.Visible = false;
}
}
}
|
|
|
|
|
As I said, use client side script.
set AutoPostBack to false and attach a clientside handler for the checkbox.
In fact, if you don't need to run on the server, entirely remove the server checkbox (runat server) and add an html checkbox.
Help on HTML[^]
Help with javascript[^]
V.
|
|
|
|