|
OK,
the postfix of 3+4 is 34+ (operands first, then operator)
so the postfix of -3 is 3- (you may want use two different minus symbols, one for biadic,
one for monadic, although even in postfix it is clear: there is only one operand available)
and the postfix of 3! is 3! (again operand(s) first, then operator).
Luc Pattyn
|
|
|
|
|
Thanks, I think I got some hold of it now.
Currently my algorithm is like this:
-If next token is an operand, add it to output array, change state to not readingOperator
-If next token is an operator:
------If state is readingOperator, and token is + or -, acknowledge it as signed value
------If state is not, change state to readingOperator.
------If operator is "!", add it to output array, and change state to not readingOperator
------If operator stack is empty, push token into stack
------If top of operator stack is a higher precedent operator, pop it out and add to output array. Repeat this step.
------If top of operator stack is a lower precedent operator, push token into operator stack.
-Repeat till there is no more token.
Will this algorithm be ok ? Is there any problem with it ?
|
|
|
|
|
Well, it may be right, it sure is close. I am not going to check all the details for you,
you should figure it out yourself
I suggest you experiment with say 5 expressions, first symbolically
(=parsing), then by executing your postfix as well as the original to compare results.
So you could try e.g.
6*5+4
6+5*4
if allowed by your input language also 6*(5+4) and the like
once all of these are correct, you could try longer expressions (but it would be hard
to mess them up once you got the basics)
so now is the time to replace one of the numbers by -2 or by 3!
if you know how to handle parentheses, you could introduce functions such as in 3+sqrt(4*5)-2
this is not very hard
and if you think everything is fine, then go for exponentiation:
6+5^4 (looks simple)
but what about: 2^3^2 (remember, exponentiation goes right-to-left,
whereas ! does not, so 3!! is nothing special but 2^3^2 is)
but don't try the more difficult ones as long as the simpler ones are not absolutely correct
It is up to you how far you want to go...
Luc Pattyn
|
|
|
|
|
Thanks, it's good to know I'm on the right track.
|
|
|
|
|
Hi All,
i try to create the fibonacci code ( 0,1,1,2,3,5,8,13,....etc) in vb6, but i feel dificulty to get the amount from entire fibonaci number. please help me. the amount is in sum.text
Dim N As Long
Dim X As Long
Dim F As Long
Dim F2 As Long
Dim M As Long
Dim R As String
F = 1
F2 = 1
N = Val(Text1.Text)
For M = 2 To N
X = F2
F2 = F2 + F
F = X
R = R + Str(F2) + ","
Next M
sum.Text = F2 + f
Text3.Text = "1," + R
End Sub
please help me.
|
|
|
|
|
I guess you want the sum of all the numbers belonging to the sequence, so:
F = 1
F2 = 1
N = Val(Text1.Text)
X = 1 'X holds the Sum
For M = 2 To N
F2 = F2 + F
X = X + F2
F = F2
R = R + Str(F2) + ","
Next M
Sum.Text = X
I'm assuming the sequence you generated is correct.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hello All,
On another forum a while back I did a post on Fuzzy Matching where I made available source code for string matching algorithms.
As it is I am an Access/VB programmer. There is an Access database I developed as a demo that illustrates the use of certain string matching algorithms that achieve a precision/recall of 99%.
For those who may be interested the original post is at:
<a href="http://www.kdkeys.net/forums/thread/6432.aspx">http://www.kdkeys.net/forums/thread/6432.aspx</a>[<a href="http://www.kdkeys.net/forums/thread/6432.aspx" target="_blank" title="New Window">^</a>]
How to use the database for your own purpose is also posted at:
<a href="http://www.kdkeys.net/forums/thread/6983.aspx">http://www.kdkeys.net/forums/thread/6983.aspx</a>[<a href="http://www.kdkeys.net/forums/thread/6983.aspx" target="_blank" title="New Window">^</a>]
Within those posts is a link for downloading the package (database, algorithm source, etc.)
At this site I am DataClean - there I am OpnSeason.
Matching is divine....
|
|
|
|
|
Can you please make public available your package (at the moment a registration to Free Data Mining Source Code is required)?
Thanks...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
That would have to be done by the moderator.
|
|
|
|
|
You can post here an article about.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Does anybody have algorithm for character extraction from image ?
Where characters are deformed but in one horizontal line and vertically they are overlapping (i.e. it is not possible to separate two character through a vertical line ).........
Waiting for ur response ????
Sumit Mishra
email iit.sumit@gmail.com
|
|
|
|
|
Don't post in multiple forums. Choose an appropriate one and wait for answers. Multposting is considered spamming and rude.
|
|
|
|
|
It depends on what you wish to do with this algorithm. If you intend to make some kind of bot software for signing up on forums, for example, and posting advertisements, then you will quickly be shunned, and it is likely that you or your post may be removed from these forums. If, however your intentions are good, then somebody is likely to help you. Please detail your exact use for this algorithm.
|
|
|
|
|
I'm looking to convert a jpg image to a text file or at least into some format that is readable even if it's in hex or ASCII. Basically I want to convert the jpg to data then use a portion of it to be compared to another similar data set. The thing is I'm really new to this programming thing and I'm not sure if I'm asking for the impossible.
If anyone could give me some advice on this it would be grand. The language I'm using is c++ but before I can even write the code for it I need to find the conversion
method.
|
|
|
|
|
Please don't cross post
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
Ed.Poore wrote: Are you wanting to compare parts of the original file (which may change due to compression etc) or are you trying to compare pixel colours etc?
Sorry about the cross posting wasn't sure where the best place for this type of question was going to be.
but since you ask..
yes parts of the original to parts of a stored copy. The compression should be the same as they will be the same format and size and if I have this right in my head the vectors will be of a very specific portion of the image. pixel colours won't help much as it's all in black and white. at least till I get told otherwise hahahahaha
|
|
|
|
|
A jpg IS data!
Is the jpg an image of text that you want to convert into editable text (OCR)?
Or do you just want to convert the raw binary data into a string?
Or do you just want to compare to jpg's?
|
|
|
|
|
eggsovereasy wrote: Or do you just want to convert the raw binary data into a string?
Or do you just want to compare to jpg's?
A bit of both really. I only want to use a portion of the data in the jpg not all. if I can extract only the part I need I can discard the unwanted data(save space and speed possibly) and use the converted data for my comparison.
I've found lots of information on how a jpg's data is structured but not on how to convert it to a form that can be read. No text in the image.
|
|
|
|
|
Lowki wrote: I've found lots of information on how a jpg's data is structured but not on how to convert it to a form that can be read. No text in the image.
Can you explain (carefully) what you're trying to accomplish here? Do you want to perform OCR on the image or are you just getting confused ?
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
Confusion is always part of the problem it's what makes it fun. OCR seemed to me to be a longer way around what I was trying to do I have samples of 106 images each with a unique identifying symbol. I want to take the bit of data with the symbol on it and compare it to a database of all the other symbols till it matches the one it's being compared to. Recognition of sorts. I thought (perhaps wrongly) that it would be simpler to convert the images to raw data like ascii or hex or just raw text code even and cut the bit that has the symbol in it. If I took another image and made it the same size made it blank and experimented on where the data changes as lines are added to it I could in theory work out which portion of the code I would need to cut out. I'm all very new to it all so this may not be feasible which is why I'm asking the question.
|
|
|
|
|
For jpegs this is not possible to my understanding because of the nature of the compression, I seem to remember somewhere that it compresses in swirls rather than lines and I don't think that two images that look the same will look similar on disk when they're compressed.
So I think you'll have to decompress the whole image first, after that you could either use OCR or just pattern recognition but you'll have to decompress it first I think.
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
decompress? ah ... I see.. right then.
|
|
|
|
|
Undestand now ?
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
I get the jist of it. Decompressing the a jpg seems to be bit problematic .I've been looking for info on how that’s done and it's proving a bit fruitless ,will just have to keep looking. I did manage to open the jpgs with a hex editor but that’s not going to help me much. As you said the encryption is quite involved on jpgs. If even one pixel is different it changes the entire hex code aside from the first chuck which I assume would be the size and thumbnail information. But after that it even changes the image information in hex if you've saved onto the same image without making any changes. I'm hoping that decompressing the jpg will give me more of a standardised result otherwise the variables are going to be enormous
|
|
|
|
|
Take a look at http://www.ijg.org/[^] there's some links there for C code to decompress JPEGs I think.
I have no idea what I just said. But my intentions were sincere.
|
|
|
|