OK. I'll ask the 'stupid question of the day'. What's a bigram? I've looked on the internet and I'm still not really any wiser. Would you post some sample text with the calculations for the required result. Then I'll have a look once I understand what the code is supposed to do. :)
If I do like this, I think it's not great because it's slow, can you help me?
I don't see anywhere in your second code where you call vector::size(), so based on what do measure it's "slow"?
I found the code for the frequencies on your forum.
If you're trying to make a program by copy\pasting random code found on internet into your IDE, that's not how to write programs.
You need solid foundations first, jumping ahead of time won't get you far.
EDIT:
You loop is wrong: for (int i = 0, len = s.size(); i < len; i++)
Correct:
1 2 3 4 5 6 7 8
for (int i = 0, len = s.length(); i < len; i++)
{
if (ispunct(s[i]))
{
s.erase(i--, 1);
len = s.size();
}
}
Remove #include <bits/stdc++.h> because it's not needed and non standard header.
If you want to make it faster don't us push_back(), instead use operator[]
This applies to your second for loop inside the main()
Tokenize and make_bigrams functions execute <1 and 1 miliseconds respectively which is very fast compared to for loop, but then your loop eats all of the remaining time.
> Knowing this I think that learning a programming language by heart at university
> is like learning to use a manual loom in the age of mechanization !
Yet you're here anyway, stumped for what to do.
University (the good ones) don't teach you programming languages.
They teach you how to program.
It's the difference between "how" you do things, and "what" you choose to perform any given task.
It's the difference between learning "how" to drive, and "what" you choose to do whatever you need doing. Everyone learns in something slow and underpowered. What you choose afterwards (sports car, MPV, SUV, truck, big-rig) depends on what you want.
You just jumped in behind the wheel and thought 'sh!t, what do I do now?'.
You've seen it done, it looked simple enough from the outside, but the cold hard reality of the situation is is that you don't know anything.
Instead of driving to your destination, you're in a ditch having failed to negotiate the first bend in the road.
Asking the cplusplus tow-truck team to drag your @ss out of the mess you've made for yourself.
We've seen lately a spate of ill-tempered new users expecting free help that caters to their programming world-view, and they get all uppity when reality doesn't conform to their whims.
The little powers you have on this website is a danger to yourself. You insult people without knowing who they are in real life. And even if this is not the case of those who leave you to your pride when leaving the forum, one day you may have surprises. Your pretty code does not complete what you can have between the legs. So revel in the miserable power you have left!
wow, that's deep. Touched me in all the tickly places.
LOL. If I was scared a dumb Internet argument might spill into IRL, I'd be so scared of people I meet in person I wouldn't even be able to leave the house.
I don't know what happened here, but I very much doubt you were attacked gratuitously. If you did that thing you're doing now where you're making every post from a different account, it would not surprise if the others didn't like that.
Either way, acting like a lost little lamb who doesn't know what it did wrong after the shitstorm has passed is rather disingenuous.
I've done some fairly dangerous things, but I don't think telling a weirdo that he's not wanted here is one of them. Just go, man. You're wasting your time.