Skip to content

Instantly share code, notes, and snippets.

View diogodanielsoaresferreira's full-sized avatar
🚀

Diogo Ferreira diogodanielsoaresferreira

🚀
View GitHub Profile
Query: Democrats win republicans in election.
5 most similar descriptions using TF-IDF
Democrat Richard Cordray will face Republican Mike DeWine in November.
Ohio state Sen. Troy Balderson now will face a Democrat in an Aug. 7 special election.
Republican Morrisey will face Sen. Joe Manchin, a conservative Democrat who has voted for the president's agenda 61 percent of the time.
Haspel looks all but assured to win confirmation in a vote before the full Senate.
"I win either way," second-place finisher Caleb Lee Hutchinson said.
5 most similar descriptions using Doc2Vec
Description: Artificial intelligence will take over our jobs.
5 most similar descriptions using TF-IDF
It's over.
There’s a reason the voice of Shuri’s artificial intelligence computer system sounded so familiar — at least to those who routinely watch Comedy Central.
“To see our elected leaders do nothing over and over again, it’s just an incredibly sad situation.”
The "Merc With A Mouth" takes over the "Late Show" monologue.
"We thank God, and all our families and friends who prayed for us and for our return."
5 most similar descriptions using Doc2Vec
Player name Best positions in FM 2017 Predicted best positions
Cristiano Ronaldo Striker, AttackingMidLeft, AttackingMidRight, MidfielderLeft Striker, AttackingMidCentral
Lionel Messi Striker, AttackingMidCentral, AttackingMidRight AttackingMidCentral, AttackingMidLeft
Neymar Striker, AttackingMidCentral, AttackingMidLeft, MidfielderLeft AttackingMidCentral, AttackingMidLeft, AttackingMidRight
Kevin De Bruyne AttackingMidCentral, AttackingMidLeft, AttackingMidRight, MidfielderCentral, MidfielderLeft, MidfielderRight AttackingMidCentral, AttackingMidLeft
Harry Kane Striker Striker
Luka Modric AttackingMidCentral, MidfielderCentral AttackingMidCentral, MidfielderCentral
Manuel Neuer Goalkeeper Goalkeeper
Philipp Lahm DefenderLeft, DefenderRight, DefensiveMidfielder, WingBackLeft, WingBackRight DefenderRight
Andrea Pirlo DefensiveMidfielder, MidfielderCentral AttackingMidCentral, MidfielderCentral
{
"id": 1,
"text": "Hello Peter!",
"emitter": "John",
"type": "chat",
"devices": [
"smartphone",
"pc"
]
}
public class CamelRoutes extends EndpointRouteBuilder {
public void configure() {
from("kafka:input_topic?brokers=localhost:9092&groupId=group1")
.log("${body}")
.to("kafka:output_topic?brokers=localhost:9092");
}
}
public void configure() {
from("kafka:input_topic?brokers=localhost:9092&groupId=group1")
.unmarshal().json(UserMessage.class)
.filter(simple("${body.type} == 'chat'"))
.log("${body}")
.marshal().json()
.to("kafka:output_topic?brokers=localhost:9092");
}
@Data
@RegisterForReflection
public class UserMessage {
private int id;
private String text;
private String emitter;
private String type;
private List<String> devices;
// ...
.to("kafka:output_topic?brokers=localhost:9092")
.unmarshal().json(UserMessage.class)
.choice()
.when(simple("${body.emitter} == 'John Doe'"))
.marshal().json().to("file://YOUR_PATH/user-message?filename=events.json&fileExist=Append&appendChars=\\n")
.otherwise()
.marshal().json().to("file://YOUR_PATH/john-doe-message?filename=events.json&fileExist=Append&appendChars=\\n")
// ...
.filter(simple("${body.type} == 'chat'"))
.log("${body}")
.split(simple("${body.devices}"))
.log("${body}")
.end()
.marshal().json()
.to("kafka:output_topic?brokers=localhost:9092")
//...
from("kafka:input_topic?brokers=localhost:9092&groupId=group2")
.unmarshal().json(UserMessage.class)
.aggregate(simple("${body.emitter}"), new CombinedUserMessagesAggregationStrategy())
.completionInterval(5000)
.log("${body}");
//...