This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Transfer Learning for Natural Language Processing (MEAP) and have Paul Azunre on-line!
See this thread for details.
Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!

Scotty Steven

Ranch Hand
+ Follow
since Jan 27, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Scotty Steven

I am so glad I could help. Sometimes, when a person is too close to a project, they can't see the answer that is right in front of them clearly. Sometimes, more can be learned by a bit of spoon feeding then by causing them frustration. I'm pretty new and know what it is like to be sitting there with a problem and a teacher who knows the solution chooses to make you feel like a dummy. I guess that's how they get to feel superior.
6 years ago
What about adding the following to the D_Component class



In the D_Viewer class change line 21 to


or if that doesn't work,

I haven't tried it on your code, but some research at this link makes me feel this could work.
6 years ago
I see this is already answered, but get to know how to use the comparable interface thoroughly. It is quite handy and worth studying further. You will use this one over and over again.
6 years ago
Jenn Terry: I reread this thread and if I understand what Rob is saying, you somehow have to create a way for the Component class to figure out it's own size and pass those sizes to the Viewer class. Maybe you could just add up all of the x and y axis starting and stop points and make them public variables? If you can't figure out how to make it work with Robs way, then you could manually set those values using the method that R. Ramage posted since you said it kind of worked. I hope this helps.
6 years ago
Rob Camick:

This girl is obviously not understanding what you are saying. It might be beyond her knowledge level. I think that is why she came here looking for help and asking questions. Would it really hurt you after a week to maybe put out a little extra effort and give her the answer that you obviously already know? Why would you ask her to post code if you were just going to tell her off after doing as you ask? I'd help, but I just started reading this forum trying to learn swing myself and for sure know less then her.
6 years ago

No. no, no, don't look there, because I happen to know one page in that link has a little application which counts words in text. It is really long and complicated: about ten lines.

Earlier, I wrote:
. . . about ten lines.
No, I was mistaken. even if you miss out comments and blank lines, it comes to twelve lines.



Okay. Got anything more specific? I have been educating myself on Binary Search trees, which seem to fit what I'm looking for. I've been teaching myself by playing with one that has to do with numbers and traversing the tree with pre-ordered,in-ordered, and post-ordered, but that is as far as I've gotten.

Now I know what the application is for, I would suggest you do the counting first and the sorting afterwards.



I agree.

There are algorithms which people use to try and identify authors' styles.



I am aware that there are more complicated was of doing this. They explore word use patterns, but ignore reuse of words. With students checking their work through grammar correction sites such as Grammerly.com, those style tests are becoming less reliable. My thesis is to show that a much simpler way exists; that the number of occurrences/some word count will also show the likelihood that a particular word belongs to an author.
6 years ago
Here is the project in a nut shell. Some students have other students write papers for them. This practice has been going on for decades. I am theorizing that each writer has their own style and as such, repetitively use the same words over and over. What I am setting out to do is create a program that will count the writers use of each word in document, and compare that to other written papers by the same student. I'm theorizing that a pattern should start to appear and any deviation might indicate a change in authors.

So, as part of my research, I am looking at 100's or even thousands of papers, one at a time by multiple authors and extracting the word counts from each as part of the data collection stage of my thesis. As such, some of these papers will be ten's of thousands of words long (I will be starting with published authors to establish if the theory is worthy of further research). Therefore, searching the tree efficiently to populate the words and increment the word counts efficiently is important and therefore sorting is important.

Once the tree has been completely populated, the tree needs to be sorted from largest number of occurrences of a word to smallest.
6 years ago

Campbell Ritchie wrote:

But: Why are the methods private and static? If they are private, they are only accessible inside your class. If they are inside the class only, the tree must be a member of that class, and ought to be an instance field. So why have you made those methods static?



The truth is, I never gave it much thought. These methods were extracted from a larger method. The program duplicated these lines, so I used Eclipse to extract them into their own methods and figuring that Eclipse knows java way better then I, never questioned it.

As for the \n, I removed it and placed it elsewhere. My understanding of java is System.out.println(""); and System.out.println(); are treated exactly the same at compiler time. I find System.out.println(""); easier to read and use it purely as a personal preference.
6 years ago

Chan wrote:

You mean a 'String'? Remember Java is case-sensitive.



Yes, I mean 'String'. I understand that Java is case-sensitive. The sentence I wrote was not in code, so I sometime fall back to my default English language which is also case-sensitive.

Chan wrote:

So that means the String's' can repeat and the tree can hold duplicates. You have not specified how you would handle inserts/updates/deletes of duplicate nodes.



No. I guess I wasn't clear enough when I said "The integer would strictly be used to record the number of times the string appears." If a duplicate String appears, instead of inserting the String that already exists, the count integer would advance one. So, the first time the word "programming" appears, it is inserted into the tree along with an integer which would hold the starting value of 1. The next time the word "programming" appears, when the search algorithm finds the duplication, it would trigger the count integer to advance to 2 and would not insert the duplicate into the tree. The compared Strings would be setup to not be case-sensitive.

Chan wrote:

Does an equal node traverse the right subtree or does it traverse the left subtree of this node? What is your algorithm ( let us know in plain text ) going to be?



Let's go with if greater than, go right. If lesser than, go left.

How does a delete operation correct the count value in the affected nodes ( i.e for cases when you have count > 1 ).



Fair enough. In this project, it will be insert only. This is strictly to keep track of the number of times a String appears in a text file that will be read by the program. No deletions will occur. However, I think a re-balancing of the tree should occur after a couple of insertions.

Scotty Steven wrote:


Any suggestions on how to do this, or do you know of code that already exist similar to what I'm looking to do that cam be studied?

Thanks

Chan wrote:

What have you tried? Plus I think we require more details about your problem statement and we need to know your algorithm. Implementation comes much later.

Chan

.

I haven't coded anything yet. I am trying to figure out how to make this work and looking for a starting point. I know how I'd like it to work, but can not quite figure out how to begin. As such, I decided to request help from people more knowledgeable then myself on the subject. I thought someone could point me towards my goal, or perhaps knew of existing code that I could use as a starting point, but would require reworking it to make it fit.
6 years ago
I came up with the following. Much cleaner, in my opinion. I really don't see any way of reducing them any further. Thanks for the help/advice.

6 years ago
To be honest, I have no reason for wanting to do this other then it looked like something that could (or should?) be done. It was more of a gut feeling this really that I wanted to use for my own educational purposes. An attempt to grow and improve, if you will. If I'm best to leave alone, then that too is educational.
6 years ago
Hello,

I am looking to write a binary tree in which each node holds both a string and an int value. I want to sort via the string. The integer would strictly be used to record the number of times the string appears. Any suggestions on how to do this, or do you know of code that already exist similar to what I'm looking to do that cam be studied?

Thanks
6 years ago
I have three methods that are almost 100% idential except for one line. I'm trying to figure out how to reduce this to one method, if at all possible, but I'm banging my head and pulling hair trying to figure out how. Any suggestions?


6 years ago
Solved in other thread!
8 years ago
That was the solution! Thing is, I played with both the getClass().getResource() and fileURL last night, but not in this combination.

Thank you very much!!!
8 years ago