Initial push with maven

This commit is contained in:
2019-06-02 21:09:12 +09:00
parent f6c36160ea
commit c569fc531d
9 changed files with 660 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="CAu_NLP_2019" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,393 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="878e5c11-e08f-43ee-a4df-9d0edd20ed32" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/out/" />
<ignored path="$PROJECT_DIR$/target/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="DefaultGradleProjectSettings">
<option name="testRunner" value="GRADLE" />
<option name="delegatedBuild" value="true" />
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="14" column="16" lean-forward="true" selection-start-line="14" selection-start-column="16" selection-end-line="14" selection-end-column="16" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/App.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="100" column="15" selection-start-line="100" selection-start-column="15" selection-end-line="100" selection-end-column="15" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/CAu_NLP_2019.iml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="41" selection-start-line="1" selection-start-column="41" selection-end-line="1" selection-end-column="41" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/Article.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#443#444#0" expanded="true" />
<element signature="e#472#473#0" expanded="true" />
<element signature="e#516#517#0" expanded="true" />
<element signature="e#550#551#0" expanded="true" />
<element signature="e#588#589#0" expanded="true" />
<element signature="e#616#617#0" expanded="true" />
<element signature="e#656#657#0" expanded="true" />
<element signature="e#686#687#0" expanded="true" />
<element signature="e#721#722#0" expanded="true" />
<element signature="e#759#760#0" expanded="true" />
<element signature="e#794#795#0" expanded="true" />
<element signature="e#830#831#0" expanded="true" />
<element signature="e#872#873#0" expanded="true" />
<element signature="e#912#913#0" expanded="true" />
<element signature="e#949#950#0" expanded="true" />
<element signature="e#984#985#0" expanded="true" />
<element signature="e#1021#1022#0" expanded="true" />
<element signature="e#1057#1058#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main/java/App.java" />
<option value="$PROJECT_DIR$/src/main/java/Article.java" />
<option value="$PROJECT_DIR$/CAu_NLP_2019.iml" />
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="260" />
<option name="y" value="40" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="CAu_NLP_2019" type="b2602c69:ProjectViewProjectNode" />
<item name="CAu_NLP_2019" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CAu_NLP_2019" type="b2602c69:ProjectViewProjectNode" />
<item name="CAu_NLP_2019" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CAu_NLP_2019" type="b2602c69:ProjectViewProjectNode" />
<item name="CAu_NLP_2019" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CAu_NLP_2019" type="b2602c69:ProjectViewProjectNode" />
<item name="CAu_NLP_2019" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CAu_NLP_2019" type="b2602c69:ProjectViewProjectNode" />
<item name="CAu_NLP_2019" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CAu_NLP_2019" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="project.structure.last.edited" value="SDKs" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="App" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="App" />
<module name="CAu_NLP_2019" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.App" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="878e5c11-e08f-43ee-a4df-9d0edd20ed32" name="Default Changelist" comment="" />
<created>1559476475559</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1559476475559</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1096" extended-state="6" />
<layout>
<window_info id="Image Layers" />
<window_info id="Designer" />
<window_info id="UI Designer" />
<window_info id="Capture Tool" />
<window_info id="Favorites" side_tool="true" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.17857143" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Version Control" />
<window_info anchor="bottom" id="Terminal" sideWeight="0.49946696" weight="0.32917964" />
<window_info anchor="bottom" id="Event Log" sideWeight="0.50053304" side_tool="true" visible="true" weight="0.32917964" />
<window_info anchor="bottom" id="Messages" weight="0.32917964" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49946696" weight="0.32917964" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="right" id="Palette" />
<window_info anchor="right" id="Theme Preview" />
<window_info anchor="right" id="Maven" />
<window_info anchor="right" id="Capture Analysis" />
<window_info anchor="right" id="Palette&#9;" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout>
<layout-to-restore>
<window_info id="Image Layers" order="0" />
<window_info id="Designer" order="1" />
<window_info id="UI Designer" order="2" />
<window_info id="Capture Tool" order="3" />
<window_info id="Favorites" order="4" side_tool="true" />
<window_info content_ui="combo" id="Project" order="5" visible="true" weight="0.17857143" />
<window_info id="Structure" order="6" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Version Control" order="0" />
<window_info anchor="bottom" id="Terminal" order="1" />
<window_info anchor="bottom" id="Event Log" order="2" side_tool="true" />
<window_info active="true" anchor="bottom" id="Messages" order="3" visible="true" weight="0.32917964" />
<window_info anchor="bottom" id="Message" order="4" />
<window_info anchor="bottom" id="Find" order="5" />
<window_info anchor="bottom" id="Run" order="6" />
<window_info anchor="bottom" id="Debug" order="7" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="8" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="9" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="10" />
<window_info anchor="right" id="Palette" order="0" />
<window_info anchor="right" id="Capture Analysis" order="1" />
<window_info anchor="right" id="Theme Preview" order="2" />
<window_info anchor="right" id="Palette&#9;" order="3" />
<window_info anchor="right" id="Maven" order="4" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="5" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="6" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="7" weight="0.25" />
</layout-to-restore>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/CAu_NLP_2019.iml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="41" selection-start-line="1" selection-start-column="41" selection-end-line="1" selection-end-column="41" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/App.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="100" column="15" selection-start-line="100" selection-start-column="15" selection-end-line="100" selection-end-column="15" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/Article.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#443#444#0" expanded="true" />
<element signature="e#472#473#0" expanded="true" />
<element signature="e#516#517#0" expanded="true" />
<element signature="e#550#551#0" expanded="true" />
<element signature="e#588#589#0" expanded="true" />
<element signature="e#616#617#0" expanded="true" />
<element signature="e#656#657#0" expanded="true" />
<element signature="e#686#687#0" expanded="true" />
<element signature="e#721#722#0" expanded="true" />
<element signature="e#759#760#0" expanded="true" />
<element signature="e#794#795#0" expanded="true" />
<element signature="e#830#831#0" expanded="true" />
<element signature="e#872#873#0" expanded="true" />
<element signature="e#912#913#0" expanded="true" />
<element signature="e#949#950#0" expanded="true" />
<element signature="e#984#985#0" expanded="true" />
<element signature="e#1021#1022#0" expanded="true" />
<element signature="e#1057#1058#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="238">
<caret line="14" column="16" lean-forward="true" selection-start-line="14" selection-start-column="16" selection-end-line="14" selection-end-column="16" />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>11</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>CAu_NLP_2019</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
<option value="0.6" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectJDKs.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<last-edited>Maven: org.jsoup:jsoup:1.11.3</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />

32
CAu_NLP_2019/pom.xml Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<groupId>PQMAN</groupId>
<artifactId>CAu_NLP_2019</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
</project>

View File

@ -0,0 +1,155 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.StringTokenizer;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class App {
public static void main(String[] args) throws Exception {
String url[] = {"https://www.thesun.co.uk/?s=", "https://www.bbc.co.uk/search?q=", "https://www.skysports.com/search?q="};
//ArrayList<String> key = new ArrayList<String>();
Article data = new Article();
//key.add("salah");
//key.add("Liverpool");
//key.add("Champions league");
Document doc = null;
Elements element = null;
Scanner scanner = new Scanner(System.in);
System.out.print("Please type keywords : ");
String key[] = scanner.nextLine().split(",");
scanner.close();
for (int j = 0; j < url.length; j++) {
for (int i = 0; i < key.length; i++) {
String urlTmp = url[j] + key[i];
doc = Jsoup.connect(urlTmp).execute().parse();
/* } catch (IOException e) {
e.printStackTrace();
}*/
if (url[j].equals("https://www.thesun.co.uk/?s=")) {
element = doc.select("div.search-results-wrap");
for (Element el : element.select(".teaser-item")) {
if (el.select("p").text().toLowerCase().contains(key[i].toLowerCase())) {
data.setHeadline(el.select("p").text());
Elements elUrl = el.select(".teaser__copy-container a");
data.setUrl(elUrl.first().absUrl("href"));
String temp = el.select(".search-date").text();
data.setDate(changeDate(temp));
data.setSite("The Sun");
}
}
}
if (url[j].equals("https://www.bbc.co.uk/search?q=")) {
element = doc.select("section.search-content");
for (Element el : element.select("li[data-result-number]")) {
data.setHeadline(el.select("h1").select("a").text());
Elements elUrl = el.select("a[href]");
data.setUrl(elUrl.first().absUrl("href"));
String temp = el.select(".display-date").text();
data.setDate(changeDate(temp));
data.setSite("BBC");
}
}
if (url[j].equals("https://www.skysports.com/search?q=")) {
element = doc.select("div.news-list");
for (Element el : element.select("div.news-list__item")) {
data.setHeadline(el.select("h4").select("a").text());
Elements elUrl = el.select("a[href]");
data.setUrl(elUrl.first().absUrl("href"));
String temp = el.select(".label__timestamp").text();
data.setDate(changeDate2(temp));
data.setSite("SKYSPORTS");
}
}
}
}
for(int i = 0; i < data.getHowManyData(); i++) {
System.out.println(data.getDate(i));
System.out.println(data.getHeadline(i));
System.out.println(data.getUrl(i));
System.out.println(data.getSite(i));
}
}
public static int changeDate2(String date) {
date = date.substring(0, 2) + date.substring(2 + 1);
date = date.substring(0, 4) + date.substring(4 + 1);
String year = date.substring(4, 8);
String month = date.substring(2,4);
String day = date.substring(0, 2);
String fdate = year + month + day;
int mydate = Integer.parseInt(fdate);
return mydate;
}
public static int changeDate(String date) {
int formdate = 0;
String sp[] = date.split(" ");
formdate += Integer.parseInt(sp[2]) * 10000;
formdate += Integer.parseInt(sp[0]);
switch (sp[1]) {
case "January":
case "Jan":
formdate += 100;
break;
case "February":
case "Feb":
formdate += 200;
break;
case "March":
case "Mar":
formdate += 300;
break;
case "April":
case "Apr":
formdate += 400;
break;
case "May":
formdate += 500;
break;
case "June":
case "Jun":
formdate += 600;
break;
case "July":
case "Jul":
formdate += 700;
break;
case "August":
case "Aug":
formdate += 800;
break;
case "September":
case "Sep":
formdate += 900;
break;
case "October":
case "Oct":
formdate += 1000;
break;
case "November":
case "Nov":
formdate += 1100;
break;
case "December":
case "Dec":
formdate += 1200;
break;
}
return formdate;
}
}

View File

@ -0,0 +1,51 @@
import java.util.ArrayList;
public class Article {
public Article() {
date = new ArrayList<Integer>();
Headline = new ArrayList<String>();
Url = new ArrayList<String>();
Site = new ArrayList<String>();
}
private ArrayList<Integer> date;
private ArrayList<String> Headline;
private ArrayList<String> Url;
private ArrayList<String> Site;
public void setDate(int num) {
date.add(num);
}
public void setHeadline(String head) {
Headline.add(head);
}
public void setUrl(String url) {
Url.add(url);
}
public void setSite(String site) {
Site.add(site);
}
public int getHowManyData() {
return Headline.size();
}
public int getDate(int num) {
return date.get(num);
}
public String getHeadline(int num) {
return Headline.get(num);
}
public String getUrl(int num) {
return Url.get(num);
}
public String getSite(int num) {
return Site.get(num);
}
}

Binary file not shown.

Binary file not shown.