This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Neutral I went for a walk | |
Neutral It is a hot day | |
Neutral good to follow a minimalist life | |
Neutral working hard is key to success | |
Neutral side hustle is one way to come out of 9 to 5 job | |
Neutral motivation is the key | |
Neutral rules to make money | |
Neutral Weather is pleasant | |
Angry not happy | |
Angry its bad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void generateModel() throws IOException { | |
File file = ResourceUtils.getFile("src/main/resources/training-data.txt"); | |
InputStreamFactory inputStreamFactory = new MarkableFileInputStreamFactory(file); | |
ObjectStream<String> lineStream = new PlainTextByLineStream(inputStreamFactory, "UTF-8"); | |
ObjectStream<DocumentSample> sampleStream = new DocumentSampleStream(lineStream); | |
int minNgramSize = 1; | |
int maxNgramSize = 6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String ADVERB = "_RB"; | |
private static final String VERB = "_VB"; | |
private static final String ADJECTIVE = "_JJ"; | |
public List<String> fetchVerbAndAdjective(String input) throws IOException { | |
File file = ResourceUtils.getFile("src/main/resources/nlp-model/en-pos-maxent.bin"); | |
InputStream in = new FileInputStream(file); | |
POSModel model = new POSModel(in); | |
POSTaggerME tagger = new POSTaggerME(model); | |
WhitespaceTokenizer whitespaceTokenizer = WhitespaceTokenizer.INSTANCE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>com.graphql-java-kickstart</groupId> | |
<artifactId>graphql-spring-boot-starter</artifactId> | |
<version>7.0.1</version> | |
</dependency> | |
<dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws InterruptedException, ExecutionException { | |
ExecutorService executor = Executors.newSingleThreadExecutor(); | |
Future<Integer> cf = executor.submit(() -> { | |
return 1; | |
}); | |
System.out.print("Result " + (cf.get() + 2)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Observable<Integer> observable1 = Observable.just(1, 2, 3, 4, 5); | |
Consumer<Integer> addValues = (x) -> System.out.println("Adding " + x + " ::" + (x + 2)); | |
Consumer<Integer> subValues = (x) -> System.out.println("Subtracting " + x + " :: " + (x - 1)); | |
observable1.filter(x -> x > 1).subscribe(x -> addValues.accept(x)); | |
observable1.filter(x -> x < 2).subscribe(x -> subValues.accept(x)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws InterruptedException, ExecutionException { | |
CompletableFuture<Integer> cf = CompletableFuture.supplyAsync(() -> { | |
return 1; | |
}); | |
System.out.print("Result " + cf.thenApply((x) -> { | |
return x + 2; | |
})); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package start; | |
public class Location { | |
double x; | |
double y; | |
public Location() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.java.latest; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ThreadFactory; | |
public class Sample { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.concurrent.config; | |
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReadWriteLock; | |
import java.util.concurrent.locks.ReentrantLock; | |
import java.util.concurrent.locks.ReentrantReadWriteLock; | |
public class ExecutorServiceSample { | |
public static void main(String[] args) throws InterruptedException { |
NewerOlder