You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2011/09/03 16:06:42 UTC

svn commit: r1164866 - in /incubator/opennlp/sandbox/caseditor-opennlp-plugin: ./ src/main/java/org/apache/opennlp/caseditor/ src/main/java/org/apache/opennlp/caseditor/sentdetect/

Author: joern
Date: Sat Sep  3 14:06:42 2011
New Revision: 1164866

URL: http://svn.apache.org/viewvc?rev=1164866&view=rev
Log:
OPENNLP-235 Stump for the sentence detector view

Added:
    incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferencePage.java   (with props)
    incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/
    incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorPreferencePage.java   (with props)
    incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorView.java   (with props)
    incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorViewPage.java   (with props)
Modified:
    incubator/opennlp/sandbox/caseditor-opennlp-plugin/plugin.xml
    incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferenceConstants.java

Modified: incubator/opennlp/sandbox/caseditor-opennlp-plugin/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/caseditor-opennlp-plugin/plugin.xml?rev=1164866&r1=1164865&r2=1164866&view=diff
==============================================================================
--- incubator/opennlp/sandbox/caseditor-opennlp-plugin/plugin.xml (original)
+++ incubator/opennlp/sandbox/caseditor-opennlp-plugin/plugin.xml Sat Sep  3 14:06:42 2011
@@ -23,10 +23,17 @@
 <plugin>
 
   <extension point="org.eclipse.ui.views">
+  	<category id="org.apache.opennlp.caseditor.views" name="OpenNLP" />
+  	
+    <view id="org.apache.opennlp.caseditor.sentdetect.SentenceDetectorView"
+	      name="Sentence Detector"
+          class="org.apache.opennlp.caseditor.sentdetect.SentenceDetectorView"
+          category="org.apache.opennlp.caseditor.views" />
+          
     <view id="org.apache.opennlp.caseditor.NameFinderView"
 	      name="Name Finder"
           class="org.apache.opennlp.caseditor.namefinder.NameFinderView"
-          category="org.apache.opennlp.caseditor" />	
+          category="org.apache.opennlp.caseditor.views" />
   </extension>	
 	
  <extension  point="org.eclipse.core.runtime.preferences">
@@ -37,6 +44,18 @@
  
   <extension point="org.eclipse.ui.preferencePages">
     <page
+          class="org.apache.opennlp.caseditor.OpenNLPPreferencePage"
+          id="org.apache.opennlp.caseditor.OpenNLPPreference"
+          name="OpenNLP">
+    </page>
+
+    <page
+          class="org.apache.opennlp.caseditor.sentdetect.SentenceDetectorPreferencePage"
+          id="org.apache.opennlp.caseditor.SentenceDetectorPreference"
+          name="OpenNLP Sentence Detector">
+    </page>
+    
+    <page
           class="org.apache.opennlp.caseditor.namefinder.NameFinderPreferencePage"
           id="org.apache.opennlp.caseditor.NameFinderPreference"
           name="OpenNLP Name Finder">

Modified: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferenceConstants.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferenceConstants.java?rev=1164866&r1=1164865&r2=1164866&view=diff
==============================================================================
--- incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferenceConstants.java (original)
+++ incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferenceConstants.java Sat Sep  3 14:06:42 2011
@@ -19,7 +19,8 @@ package org.apache.opennlp.caseditor;
 
 public class OpenNLPPreferenceConstants {
 
-  public static final String MODEL_PATH = "MODEL_PATH";
+  public static final String SENTENCE_DETECTOR_MODEL_PATH = "SENTENCE_DETECTOR_MODEL_PATH";
+  public static final String NAME_FINDER_MODEL_PATH = "NAME_FINDER_MODEL_PATH";
   
   public static final String SENTENCE_TYPE = "SENTENCE_TYPE";
   public static final String TOKEN_TYPE = "TOKEN_TYPE";

Added: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferencePage.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferencePage.java?rev=1164866&view=auto
==============================================================================
--- incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferencePage.java (added)
+++ incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferencePage.java Sat Sep  3 14:06:42 2011
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.opennlp.caseditor;
+
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class OpenNLPPreferencePage extends FieldEditorPreferencePage
+    implements IWorkbenchPreferencePage {
+
+  private StringFieldEditor sentenceType;
+  private StringFieldEditor tokenType;
+  
+  public OpenNLPPreferencePage() {
+    setPreferenceStore(OpenNLPPlugin.getDefault().getPreferenceStore());
+    setDescription("OpenNLP Common Preferences.");  }
+  
+  @Override
+  public void init(IWorkbench workbench) {
+  }
+
+  @Override
+  protected void createFieldEditors() {
+    sentenceType = new StringFieldEditor(
+        OpenNLPPreferenceConstants.SENTENCE_TYPE,
+        "Sentence Type", getFieldEditorParent());
+    addField(sentenceType);
+    
+    tokenType = new StringFieldEditor(
+        OpenNLPPreferenceConstants.TOKEN_TYPE,
+        "Token Type", getFieldEditorParent());
+    addField(tokenType);
+  }
+}

Propchange: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/OpenNLPPreferencePage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorPreferencePage.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorPreferencePage.java?rev=1164866&view=auto
==============================================================================
--- incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorPreferencePage.java (added)
+++ incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorPreferencePage.java Sat Sep  3 14:06:42 2011
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.opennlp.caseditor.sentdetect;
+
+import org.apache.opennlp.caseditor.OpenNLPPreferenceConstants;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class SentenceDetectorPreferencePage extends FieldEditorPreferencePage
+    implements IWorkbenchPreferencePage {
+
+  private StringFieldEditor modelPath;
+  
+  @Override
+  public void init(IWorkbench workbench) {
+  }
+
+  @Override
+  protected void createFieldEditors() {
+    modelPath = new StringFieldEditor(
+        OpenNLPPreferenceConstants.SENTENCE_DETECTOR_MODEL_PATH,
+        "Model Path", getFieldEditorParent());
+    addField(modelPath);
+  }
+
+}

Propchange: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorPreferencePage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorView.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorView.java?rev=1164866&view=auto
==============================================================================
--- incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorView.java (added)
+++ incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorView.java Sat Sep  3 14:06:42 2011
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.opennlp.caseditor.sentdetect;
+
+import org.apache.uima.caseditor.editor.AnnotationEditorView;
+import org.apache.uima.caseditor.editor.ICasDocument;
+import org.apache.uima.caseditor.editor.ICasEditor;
+
+public class SentenceDetectorView extends AnnotationEditorView {
+
+  public SentenceDetectorView() {
+    super("The Sentence Detector View is currently not available.");
+  }
+
+  protected PageRec doCreatePage(ICasEditor editor) {
+    PageRec result = null;
+
+    ICasDocument document = editor.getDocument();
+
+    if (document != null) {
+
+      SentenceDetectorViewPage page = new SentenceDetectorViewPage(editor);
+      initPage(page);
+      page.createControl(getPageBook());
+
+      result = new PageRec(editor, page);
+    }
+
+    return result;
+  }
+}

Propchange: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorView.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorViewPage.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorViewPage.java?rev=1164866&view=auto
==============================================================================
--- incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorViewPage.java (added)
+++ incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorViewPage.java Sat Sep  3 14:06:42 2011
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.opennlp.caseditor.sentdetect;
+
+import org.apache.uima.caseditor.editor.ICasEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.part.Page;
+
+public class SentenceDetectorViewPage extends Page {
+  
+  private ICasEditor editor;
+  
+  private Label testLabel; 
+  
+  public SentenceDetectorViewPage(ICasEditor editor) {
+    this.editor = editor;
+  }
+
+  @Override
+  public void createControl(Composite parent) {
+    // Lets start with a button to trigger
+    // the sentence detector in the background ...
+    testLabel = new Label(parent, SWT.NONE);
+    testLabel.setText("I am the sentence detector view :)");
+  }
+
+  @Override
+  public Control getControl() {
+    return testLabel;
+  }
+
+  @Override
+  public void setFocus() {
+  }
+}

Propchange: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorViewPage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain