Author: kwright
Date: Wed Jan 27 22:38:29 2016
New Revision: 1727210
URL: http://svn.apache.org/viewvc?rev=1727210&view=rev
Log:
Revamp UI
Modified:
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractor.java
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractorConfig.java
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_en_US.properties
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_ja_JP.properties
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_zh_CN.properties
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/opennlp/editSpecification_OpenNLP.html
Modified:
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractor.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractor.java?rev=1727210&r1=1727209&r2=1727210&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractor.java
(original)
+++
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractor.java
Wed Jan 27 22:38:29 2016
@@ -379,6 +379,7 @@ public class OpenNlpExtractor extends Ba
paramMap.put("SELECTEDNUM", Integer.toString(actualSequenceNumber));
fillInOpenNLPSpecificationMap(paramMap, os);
+ setUpOpenNLPSpecificationMap(paramMap);
Messages.outputResourceWithVelocity(out, locale,
EDIT_SPECIFICATION_OPENNLP_HTML, paramMap);
}
@@ -481,6 +482,12 @@ public class OpenNlpExtractor extends Ba
Messages.outputResourceWithVelocity(out, locale, VIEW_SPECIFICATION_HTML,
paramMap);
}
+ protected void setUpOpenNLPSpecificationMap(Map<String, Object> paramMap)
+ throws ManifoldCFException {
+ final String[] fileNames = getModelList();
+ paramMap.put("FILENAMES", fileNames);
+ }
+
protected static void fillInOpenNLPSpecificationMap(Map<String, Object>
paramMap, Specification os) {
String sModelPath = "";
String tModelPath = "";
@@ -575,11 +582,11 @@ public class OpenNlpExtractor extends Ba
final long bytesize)
throws ManifoldCFException {
try {
- sentenceDetector =
OpenNlpExtractorConfig.sentenceDetector(sp.getSModelPath());
- tokenizer = OpenNlpExtractorConfig.tokenizer(sp.getTModelPath());
- peopleFinder = OpenNlpExtractorConfig.peopleFinder(sp.getPModelPath());
- locationFinder =
OpenNlpExtractorConfig.locationFinder(sp.getLModelPath());
- organizationFinder =
OpenNlpExtractorConfig.organizationFinder(sp.getOModelPath());
+ sentenceDetector = OpenNlpExtractorConfig.sentenceDetector(new
File(fileDirectory,sp.getSModelPath()));
+ tokenizer = OpenNlpExtractorConfig.tokenizer(new
File(fileDirectory,sp.getTModelPath()));
+ peopleFinder = OpenNlpExtractorConfig.peopleFinder(new
File(fileDirectory,sp.getPModelPath()));
+ locationFinder = OpenNlpExtractorConfig.locationFinder(new
File(fileDirectory,sp.getLModelPath()));
+ organizationFinder = OpenNlpExtractorConfig.organizationFinder(new
File(fileDirectory,sp.getOModelPath()));
} catch (IOException e) {
throw new ManifoldCFException(e.getMessage(), e);
}
Modified:
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractorConfig.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractorConfig.java?rev=1727210&r1=1727209&r2=1727210&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractorConfig.java
(original)
+++
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/java/org/apache/manifoldcf/agents/transformation/opennlp/OpenNlpExtractorConfig.java
Wed Jan 27 22:38:29 2016
@@ -37,62 +37,62 @@ public class OpenNlpExtractorConfig
}
// Specification nodes and values
- public static final String NODE_SMODEL_PATH = "SModelPath";
- public static final String NODE_TMODEL_PATH = "TModelPath";
- public static final String NODE_PMODEL_PATH = "PModelPath";
- public static final String NODE_LMODEL_PATH = "LModelPath";
- public static final String NODE_OMODEL_PATH = "OModelPath";
+ public static final String NODE_SMODEL_PATH = "SModelPath";
+ public static final String NODE_TMODEL_PATH = "TModelPath";
+ public static final String NODE_PMODEL_PATH = "PModelPath";
+ public static final String NODE_LMODEL_PATH = "LModelPath";
+ public static final String NODE_OMODEL_PATH = "OModelPath";
- public static final String ATTRIBUTE_VALUE = "value";
+ public static final String ATTRIBUTE_VALUE = "value";
- private static SentenceModel sModel = null;
- private static TokenizerModel tModel = null;
- private static TokenNameFinderModel pModel = null;
- private static TokenNameFinderModel lModel = null;
- private static TokenNameFinderModel oModel = null;
-
- private static synchronized void initializeModel(MODEL m, String path)
throws InvalidFormatException, FileNotFoundException, IOException{
- if(sModel == null && m == MODEL.SENTENCE)
- sModel = new SentenceModel(new FileInputStream(path));
- if(tModel == null && m == MODEL.TOKENIZER)
- tModel = new TokenizerModel(new FileInputStream(path));
- if(pModel == null && m == MODEL.PEOPLE)
- pModel = new TokenNameFinderModel(new FileInputStream(path));
- if(lModel == null && m == MODEL.LOCATIONS)
- lModel = new TokenNameFinderModel(new FileInputStream(path));
- if(oModel == null && m == MODEL.ORGANIZATIONS)
- oModel = new TokenNameFinderModel(new FileInputStream(path));
- }
-
- public static final SentenceDetector sentenceDetector(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
- if(sModel == null)
- initializeModel(MODEL.SENTENCE, path);
- return new SentenceDetectorME(sModel);
- }
-
- public static final Tokenizer tokenizer(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
- if(tModel == null)
- initializeModel(MODEL.TOKENIZER, path);
- return new TokenizerME(tModel);
- }
-
- public static final NameFinderME peopleFinder(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
- if(pModel == null)
- initializeModel(MODEL.PEOPLE, path);
- return new NameFinderME(pModel);
- }
-
- public static final NameFinderME locationFinder(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
- if(lModel == null)
- initializeModel(MODEL.LOCATIONS, path);
- return new NameFinderME(lModel);
- }
-
- public static final NameFinderME organizationFinder(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
- if(oModel == null)
- initializeModel(MODEL.ORGANIZATIONS, path);
- return new NameFinderME(oModel);
- }
+ private static SentenceModel sModel = null;
+ private static TokenizerModel tModel = null;
+ private static TokenNameFinderModel pModel = null;
+ private static TokenNameFinderModel lModel = null;
+ private static TokenNameFinderModel oModel = null;
+
+ private static synchronized void initializeModel(MODEL m, String path)
throws InvalidFormatException, FileNotFoundException, IOException{
+ if(sModel == null && m == MODEL.SENTENCE)
+ sModel = new SentenceModel(new FileInputStream(path));
+ if(tModel == null && m == MODEL.TOKENIZER)
+ tModel = new TokenizerModel(new FileInputStream(path));
+ if(pModel == null && m == MODEL.PEOPLE)
+ pModel = new TokenNameFinderModel(new FileInputStream(path));
+ if(lModel == null && m == MODEL.LOCATIONS)
+ lModel = new TokenNameFinderModel(new FileInputStream(path));
+ if(oModel == null && m == MODEL.ORGANIZATIONS)
+ oModel = new TokenNameFinderModel(new FileInputStream(path));
+ }
+
+ public static final SentenceDetector sentenceDetector(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
+ if(sModel == null)
+ initializeModel(MODEL.SENTENCE, path);
+ return new SentenceDetectorME(sModel);
+ }
+
+ public static final Tokenizer tokenizer(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
+ if(tModel == null)
+ initializeModel(MODEL.TOKENIZER, path);
+ return new TokenizerME(tModel);
+ }
+
+ public static final NameFinderME peopleFinder(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
+ if(pModel == null)
+ initializeModel(MODEL.PEOPLE, path);
+ return new NameFinderME(pModel);
+ }
+
+ public static final NameFinderME locationFinder(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
+ if(lModel == null)
+ initializeModel(MODEL.LOCATIONS, path);
+ return new NameFinderME(lModel);
+ }
+
+ public static final NameFinderME organizationFinder(String path) throws
InvalidFormatException, FileNotFoundException, IOException{
+ if(oModel == null)
+ initializeModel(MODEL.ORGANIZATIONS, path);
+ return new NameFinderME(oModel);
+ }
Modified:
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_en_US.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_en_US.properties?rev=1727210&r1=1727209&r2=1727210&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_en_US.properties
(original)
+++
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_en_US.properties
Wed Jan 27 22:38:29 2016
@@ -14,8 +14,9 @@
# limitations under the License.
OpenNlpExtractor.OpenNLPTabName=OpenNlp Extraction
-OpenNlpExtractor.SentenceDetectorModelPath=Sentence Detector Model Path:
-OpenNlpExtractor.TokenizerModelPath=Tokenizer Model Path:
-OpenNlpExtractor.PeopleModelPath=People Model Path:
-OpenNlpExtractor.LocationsModelPath=Locations Model Path:
-OpenNlpExtractor.OraganizationsModelPath=Organizations Model Path:
\ No newline at end of file
+OpenNlpExtractor.SelectOne=-- Select Model File --
+OpenNlpExtractor.SentenceDetectorModelPath=Sentence detector model:
+OpenNlpExtractor.TokenizerModelPath=Tokenizer model:
+OpenNlpExtractor.PeopleModelPath=People model:
+OpenNlpExtractor.LocationsModelPath=Locations model:
+OpenNlpExtractor.OraganizationsModelPath=Organizations model:
\ No newline at end of file
Modified:
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_ja_JP.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_ja_JP.properties?rev=1727210&r1=1727209&r2=1727210&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_ja_JP.properties
(original)
+++
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_ja_JP.properties
Wed Jan 27 22:38:29 2016
@@ -14,8 +14,9 @@
# limitations under the License.
OpenNlpExtractor.OpenNLPTabName=OpenNlp Extraction
-OpenNlpExtractor.SentenceDetectorModelPath=Sentence Detector Model Path:
-OpenNlpExtractor.TokenizerModelPath=Tokenizer Model Path:
-OpenNlpExtractor.PeopleModelPath=People Model Path:
-OpenNlpExtractor.LocationsModelPath=Locations Model Path:
-OpenNlpExtractor.OraganizationsModelPath=Organizations Model Path:
\ No newline at end of file
+OpenNlpExtractor.SelectOne=-- Select Model File --
+OpenNlpExtractor.SentenceDetectorModelPath=Sentence detector model:
+OpenNlpExtractor.TokenizerModelPath=Tokenizer model:
+OpenNlpExtractor.PeopleModelPath=People model:
+OpenNlpExtractor.LocationsModelPath=Locations model:
+OpenNlpExtractor.OraganizationsModelPath=Organizations model:
\ No newline at end of file
Modified:
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_zh_CN.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_zh_CN.properties?rev=1727210&r1=1727209&r2=1727210&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_zh_CN.properties
(original)
+++
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/opennlp/common_zh_CN.properties
Wed Jan 27 22:38:29 2016
@@ -14,8 +14,9 @@
# limitations under the License.
OpenNlpExtractor.OpenNLPTabName=OpenNlp Extraction
-OpenNlpExtractor.SentenceDetectorModelPath=Sentence Detector Model Path:
-OpenNlpExtractor.TokenizerModelPath=Tokenizer Model Path:
-OpenNlpExtractor.PeopleModelPath=People Model Path:
-OpenNlpExtractor.LocationsModelPath=Locations Model Path:
-OpenNlpExtractor.OraganizationsModelPath=Organizations Model Path:
\ No newline at end of file
+OpenNlpExtractor.SelectOne=-- Select Model File --
+OpenNlpExtractor.SentenceDetectorModelPath=Sentence detector model:
+OpenNlpExtractor.TokenizerModelPath=Tokenizer model:
+OpenNlpExtractor.PeopleModelPath=People model:
+OpenNlpExtractor.LocationsModelPath=Locations model:
+OpenNlpExtractor.OraganizationsModelPath=Organizations model:
\ No newline at end of file
Modified:
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/opennlp/editSpecification_OpenNLP.html
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/opennlp/editSpecification_OpenNLP.html?rev=1727210&r1=1727209&r2=1727210&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/opennlp/editSpecification_OpenNLP.html
(original)
+++
manifoldcf/branches/CONNECTORS-1270/connectors/opennlp/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/opennlp/editSpecification_OpenNLP.html
Wed Jan 27 22:38:29 2016
@@ -15,9 +15,7 @@
limitations under the License.
-->
-#if($TABNAME ==
-$ResourceBundle.getString('OpenNlpExtractor.OpenNLPTabName') &&
-${SEQNUM} == ${SELECTEDNUM})
+#if($TABNAME == $ResourceBundle.getString('OpenNlpExtractor.OpenNLPTabName')
&& ${SEQNUM} == ${SELECTEDNUM})
<table class="displaytable">
<tr>
@@ -25,40 +23,110 @@ ${SEQNUM} == ${SELECTEDNUM})
</tr>
<tr>
<td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SentenceDetectorModelPath'))</nobr></td>
- <td class="value"><input type="text" name="s${SEQNUM}_smodelpath"
- size="128" value="$Encoder.attributeEscape($SMODELPATH)" /></td>
+ <td class="value">
+ <select name="s${SEQNUM}_smodelpath" size="3">
+ #if($SMODELPATH == "")
+ <option value=""
selected="true">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #else
+ <option
value="">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #end
+ #foreach ($FILENAME in $FILENAMES)
+ #if($FILENAME == $SMODELPATH)
+ <option value="$Encoder.attributeEscape($FILENAME)"
selected="true">$Encoder.bodyEscape($FILENAME)</option>
+ #else
+ <option
value="$Encoder.attributeEscape($FILENAME)">$Encoder.bodyEscape($FILENAME)</option>
+ #end
+ #end
+ </select>
+ </td>
</tr>
<tr>
<td class="separator" colspan="2"><hr /></td>
</tr>
<tr>
<td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.TokenizerModelPath'))</nobr></td>
- <td class="value"><input type="text" name="s${SEQNUM}_tmodelpath"
- size="128" value="$Encoder.attributeEscape($TMODELPATH)" /></td>
+ <td class="value">
+ <select name="s${SEQNUM}_tmodelpath" size="3">
+ #if($TMODELPATH == "")
+ <option value=""
selected="true">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #else
+ <option
value="">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #end
+ #foreach ($FILENAME in $FILENAMES)
+ #if($FILENAME == $TMODELPATH)
+ <option value="$Encoder.attributeEscape($FILENAME)"
selected="true">$Encoder.bodyEscape($FILENAME)</option>
+ #else
+ <option
value="$Encoder.attributeEscape($FILENAME)">$Encoder.bodyEscape($FILENAME)</option>
+ #end
+ #end
+ </select>
+ </td>
</tr>
<tr>
<td class="separator" colspan="2"><hr /></td>
</tr>
<tr>
<td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.PeopleModelPath'))</nobr></td>
- <td class="value"><input type="text" name="s${SEQNUM}_pmodelpath"
- size="128" value="$Encoder.attributeEscape($PMODELPATH)" /></td>
+ <td class="value">
+ <select name="s${SEQNUM}_pmodelpath" size="3">
+ #if($PMODELPATH == "")
+ <option value=""
selected="true">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #else
+ <option
value="">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #end
+ #foreach ($FILENAME in $FILENAMES)
+ #if($FILENAME == $PMODELPATH)
+ <option value="$Encoder.attributeEscape($FILENAME)"
selected="true">$Encoder.bodyEscape($FILENAME)</option>
+ #else
+ <option
value="$Encoder.attributeEscape($FILENAME)">$Encoder.bodyEscape($FILENAME)</option>
+ #end
+ #end
+ </select>
+ </td>
</tr>
<tr>
<td class="separator" colspan="2"><hr /></td>
</tr>
<tr>
<td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.LocationsModelPath'))</nobr></td>
- <td class="value"><input type="text" name="s${SEQNUM}_lmodelpath"
- size="128" value="$Encoder.attributeEscape($LMODELPATH)" /></td>
+ <td class="value">
+ <select name="s${SEQNUM}_lmodelpath" size="3">
+ #if($LMODELPATH == "")
+ <option value=""
selected="true">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #else
+ <option
value="">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #end
+ #foreach ($FILENAME in $FILENAMES)
+ #if($FILENAME == $LMODELPATH)
+ <option value="$Encoder.attributeEscape($FILENAME)"
selected="true">$Encoder.bodyEscape($FILENAME)</option>
+ #else
+ <option
value="$Encoder.attributeEscape($FILENAME)">$Encoder.bodyEscape($FILENAME)</option>
+ #end
+ #end
+ </select>
+ </td>
</tr>
<tr>
<td class="separator" colspan="2"><hr /></td>
</tr>
<tr>
<td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.OraganizationsModelPath'))</nobr></td>
- <td class="value"><input type="text" name="s${SEQNUM}_omodelpath"
- size="128" value="$Encoder.attributeEscape($OMODELPATH)" /></td>
+ <td class="value">
+ <select name="s${SEQNUM}_omodelpath" size="3">
+ #if($OMODELPATH == "")
+ <option value=""
selected="true">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #else
+ <option
value="">$Encoder.bodyEscape($ResourceBundle.getString('OpenNlpExtractor.SelectOne'))</option>
+ #end
+ #foreach ($FILENAME in $FILENAMES)
+ #if($FILENAME == $OMODELPATH)
+ <option value="$Encoder.attributeEscape($FILENAME)"
selected="true">$Encoder.bodyEscape($FILENAME)</option>
+ #else
+ <option
value="$Encoder.attributeEscape($FILENAME)">$Encoder.bodyEscape($FILENAME)</option>
+ #end
+ #end
+ </select>
+ </td>
</tr>
</table>