Changeset 31402 in osm for applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap
- Timestamp:
- 2015-07-24T19:43:34+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/extractor/LanguageDetector.java
r31106 r31402 43 43 44 44 if(!new File(languageProfilesPath).exists()){ 45 new File(languageProfilesPath).mkdir(); 45 //new File(languageProfilesPath).mkdir(); 46 new File(languageProfilesPath).mkdirs(); 46 47 } 47 File languageProfilesOutputFile1 = new File(languageProfilesPath + "/el"); 48 File languageProfilesOutputFile1 = new File(languageProfilesPath + "/el"); 48 49 File languageProfilesOutputFile2 = new File(languageProfilesPath +"/en"); 50 51 try { 52 System.out.println("languageProfilesOutputFile1.exists: " + languageProfilesOutputFile1.exists()); 53 System.out.println("languageProfilesOutputFile1.getAbsolutePath(): " + languageProfilesOutputFile1.getAbsolutePath()); 54 System.out.println("languageProfilesOutputFile1.canRead(): " + languageProfilesOutputFile1.canRead()); 55 System.out.println("languageProfilesOutputFile1.canWrite(): " + languageProfilesOutputFile1.canWrite()); 56 //System.out.println("languageProfilesOutputFile1.canRead(): " + languageProfilesOutputFile1.); 57 58 languageProfilesOutputFile1.createNewFile(); 59 languageProfilesOutputFile2.createNewFile(); 60 } catch (IOException ex) { 61 Logger.getLogger(LanguageDetector.class.getName()).log(Level.SEVERE, null, ex); 62 } 63 49 64 //languageProfilesOutputFile.mkdirs(); 50 65 … … 57 72 Logger.getLogger(LanguageDetector.class.getName()).log(Level.SEVERE, null, ex); 58 73 } 59 System.out.println("deb1");74 //System.out.println("deb1"); 60 75 61 76 FileOutputStream outputStream2 = null; -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/extractor/TextualListLoader.java
r31106 r31402 8 8 import java.util.logging.Level; 9 9 import java.util.logging.Logger; 10 //import org.apache.log4j.Logger; 10 11 11 12 /** … … 18 19 public class TextualListLoader { 19 20 20 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(TextualListLoader.class); 21 //private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(TextualListLoader.class); 22 //private static final Logger LOG = Logger.getLogger(TextualListLoader.class); 21 23 private List<String> namesList; 22 24 … … 36 38 namesList.add(nextLine); 37 39 } 38 LOG.info("Name occurences parsed successfully!");40 //LOG.info("Name occurences parsed successfully!"); 39 41 } 40 42 -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/OSMRecPluginHelper.java
r31108 r31402 126 126 import org.openstreetmap.josm.plugins.core.TrainWorker; 127 127 import org.openstreetmap.josm.plugins.extractor.LanguageDetector; 128 import org.openstreetmap.josm.plugins.extractor.SampleModelsExtractor; 128 129 import org.openstreetmap.josm.plugins.features.ClassFeatures; 129 130 import org.openstreetmap.josm.plugins.features.GeometryFeatures; … … 159 160 private static String MODEL_PATH; 160 161 private static String TEXTUAL_LIST_PATH; 161 162 private static Map<String, List<String>> indirectClasses; 163 private static Map<String, Integer> indirectClassesWithIDs; 164 private static LanguageDetector languageDetector; 165 private static String bestModelPath; 166 private final String modelWithClassesPath; 167 168 162 169 // Selection that we are editing by using both dialogs 163 170 Collection<OsmPrimitive> sel; … … 186 193 } 187 194 }; 195 188 196 189 private static Map<String, List<String>> indirectClasses;190 private static Map<String, Integer> indirectClassesWithIDs;191 private static LanguageDetector languageDetector;192 193 197 OSMRecPluginHelper(DefaultTableModel propertyData, Map<String, Map<String, Integer>> valueCount) { 194 198 this.tagData = propertyData; … … 203 207 MODEL_PATH = new File(MAIN_PATH).getParentFile() + "/OSMRec_models"; 204 208 TEXTUAL_LIST_PATH = MODEL_PATH + "/textualList.txt"; 209 bestModelPath = MODEL_PATH + "/best_model"; 210 modelWithClassesPath = MODEL_PATH + "/model_with_classes"; 205 211 languageDetector = LanguageDetector.getInstance(MODEL_PATH + "/profiles"); 212 213 SampleModelsExtractor sa = new SampleModelsExtractor(); 214 215 sa.extractSampleSVMmodel("best_model", bestModelPath); 216 sa.extractSampleSVMmodel("model_with_classes", modelWithClassesPath); 217 206 218 } 207 219 … … 1483 1495 configureContextsensitiveHelp("/Dialog/AddValue", true /* show help button */); 1484 1496 final AddTagsDialog lala = this; 1497 1485 1498 1486 1499 loadOntology(); … … 1497 1510 } 1498 1511 1499 1512 //if training process has not been performed, we use two sample SVM models, extracted from the jar 1513 //File bestModelFile = new File(bestModelPath); 1514 //File bestModelWithClassesFile = new File(modelWithClassesPath); 1500 1515 1501 1516 JPanel splitPanel = new JPanel(new BorderLayout(10,10)); … … 1629 1644 //get a simple selection 1630 1645 if(!osmPrimitiveSelection.isEmpty()){ 1631 s = osmPrimitiveSelection.get(0); 1632 if(s.getInterestingTags().isEmpty()){ 1646 s = osmPrimitiveSelection.get(0); 1647 File modelDirectory = new File(MODEL_PATH); 1648 String modelWithClassesPath = modelDirectory.getAbsolutePath() + "/model_with_classes"; 1649 File modelWithClassesFile = new File(modelWithClassesPath); 1650 if(s.getInterestingTags().isEmpty() || !modelWithClassesFile.exists()){ 1633 1651 loadSVMmodel(false);//load original model 1634 1652 createOSMObject(sel, false); //create object without class features … … 1650 1668 public void valueChanged(ListSelectionEvent listSelectionEvent) { 1651 1669 if (!listSelectionEvent.getValueIsAdjusting()) {//This prevents double events 1652 System.out.println("tag selected: " + categoryList.getSelectedValue());1670 //System.out.println("tag selected: " + categoryList.getSelectedValue()); 1653 1671 1654 1672 String selectedClass = categoryList.getSelectedValue(); … … 2094 2112 2095 2113 mapLabelsToIDs.put(modelSVMLabels[h], h); 2096 System.out.println(h + " <-> " + modelSVMLabels[h]);2114 //System.out.println(h + " <-> " + modelSVMLabels[h]); 2097 2115 2098 2116 } … … 2211 2229 } 2212 2230 } 2213 System.out.println("final list:" + scoreMap);2231 //System.out.println("final list:" + scoreMap); 2214 2232 } 2215 2233 } -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/parsers/Mapper.java
r31106 r31402 4 4 import java.io.FileNotFoundException; 5 5 import java.io.InputStream; 6 import java.util.Collections; 6 7 import java.util.HashMap; 8 import java.util.LinkedHashMap; 7 9 import java.util.Map; 8 10 import java.util.Scanner; … … 17 19 18 20 public class Mapper { 19 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Mapper.class);21 //private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Mapper.class); 20 22 private final HashMap<String, String> mappings; 21 23 private final HashMap<String, Integer> mappingsWithIDs; … … 23 25 public Mapper(){ 24 26 25 mappings = new HashMap<>();27 mappings = new LinkedHashMap<>(); 26 28 mappingsWithIDs = new HashMap<>(); 27 29 … … 45 47 } 46 48 constructMappingsWithIDs(); 47 48 LOG.info("Mappings file parsed successfully!");49 System.out.println("Mappings file parsed successfully!"); 50 //LOG.info("Mappings file parsed successfully!"); 49 51 } 50 52 … … 58 60 59 61 public Map<String,Integer> getMappingsWithIDs(){ 60 return this.mappingsWithIDs;62 return Collections.unmodifiableMap(mappingsWithIDs); 61 63 } 62 64 63 65 public Map<String,String> getMappings(){ 64 return this.mappings;66 return Collections.unmodifiableMap(mappings); 65 67 } 66 68 } -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/parsers/Ontology.java
r31106 r31402 50 50 ontologyModel = ModelFactory.createOntologyModel(); 51 51 52 org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.ERROR);52 //org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.ERROR); 53 53 ontologyModel.read(owlFile, null); //Hide RDFDefaultErrorHandler from terminal to keep clear output. 54 org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO);54 //org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO); 55 55 56 56 listHierarchy = ontologyModel.listHierarchyRootClasses().toList(); 57 57 setListHierarchy(listHierarchy); 58 58 59 ExtendedIterator classes = ontologyModel.listClasses();59 ExtendedIterator<OntClass> classes = ontologyModel.listClasses(); 60 60 while (classes.hasNext()) { 61 61 String className; 62 OntClass obj = (OntClass)classes.next();62 OntClass obj = classes.next(); 63 63 64 64 //compare localname with class name from map and call getSuperclass -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/parsers/TextualStatistics.java
r31106 r31402 3 3 import java.io.InputStream; 4 4 import java.util.ArrayList; 5 import java.util.Collections; 5 6 import java.util.List; 6 7 import java.util.Scanner; … … 30 31 31 32 public List<String> getTextualList(){ 32 return textualList;33 return Collections.unmodifiableList(textualList); 33 34 } 34 35 }
Note:
See TracChangeset
for help on using the changeset viewer.