Word List
-
This process imports words in a CSV format to the currently loaded dictionary. (You can save an Excel file as a CSV)
-
The CSV file must have a header line in this order: word,pronunciation,part of speech,equivalent,explanation. Your words must be formatted in the appropriate order.
-
Make sure the parts of speech for each word correspond to your dictionary's parts of speech or else it will be lost if you edit the word. If a part of speech is left blank, you can find the blanks using the "Blank" option in the Filter.
-
At a minimum, all of your words must have the "word" field and either the "equivalent" or "explanation" field filled out in the CSV file.
-
-
Import Words
+
This process imports words in a CSV format to the currently loaded dictionary. (Note: You can save an Excel file as a CSV)
+
The CSV file must have a header line in this order: word,pronunciation,part of speech,equivalent,explanation. Your word data must be in the appropriate order according to the headers. You can use this CSV as a template if you need help.
+
Make sure the parts of speech for each word correspond to your dictionary's parts of speech or else you won't be able to find it using a filter. If a part of speech is left blank, you can find the blanks using the "Blank" option in the Filter so you can clean up.
+
At a minimum, all of your words must have the "word" field and either the "equivalent" or "explanation" field filled out in the CSV file.
+
+
Import Words
+
Full Dictionary
This process imports a full dictionary previously exported from Lexiconga in a .dict format.
diff --git a/import_test.csv b/import_test.csv
index 3203999..397041d 100644
--- a/import_test.csv
+++ b/import_test.csv
@@ -1,6 +1,4 @@
-"word","pronunciation","part of speech","equivalent","explanation"
-"test","[tehst]","Noun","an example, per se!","no explanation required."
-test,"[tehst]","Verb","to test, i.e. to ""try to see"" if something works","no explanation required."
-"tested","[tehst-ehd]",Adjective,"of or relating to an example","no explanation required."
-
-"testable","[tehst-uh-bull]","Adjective","Able to be have ""tests"" run on","explanation"
\ No newline at end of file
+word,pronunciation,part of speech,equivalent,explanation
+test0, [tehst], ,dah,
+test1, [tehst], a ,dah,
+test2, [tehst], a ,dah,
\ No newline at end of file
diff --git a/js/dictionaryBuilder.js b/js/dictionaryBuilder.js
index 4d07205..edf2f22 100644
--- a/js/dictionaryBuilder.js
+++ b/js/dictionaryBuilder.js
@@ -68,7 +68,7 @@ function AddWord() {
}
}
} else {
- currentDictionary.words.push({name: word, pronunciation: pronunciation, partOfSpeech: partOfSpeech, simpleDefinition: simpleDefinition, longDefinition: longDefinition, wordId: currentDictionary.nextWordId++});
+ currentDictionary.words.push({name: word, pronunciation: pronunciation, partOfSpeech: ((partOfSpeech.length > 0) ? partOfSpeech : " "), simpleDefinition: simpleDefinition, longDefinition: longDefinition, wordId: currentDictionary.nextWordId++});
FocusAfterAddingNewWord();
NewWordNotification(word);
SaveAndUpdateDictionary(false);
@@ -103,7 +103,7 @@ function ShowWordEditForm(index) {
\
\
Part of Speech \
- \
+ \
\
Equivalent Word(s) \
\
@@ -121,6 +121,7 @@ function ShowWordEditForm(index) {
document.getElementById("entry" + indexString).innerHTML = editForm;
SetPartsOfSpeech("partOfSpeech" + indexString);
+ document.getElementById("partOfSpeech" + indexString).value = htmlEntitiesParse(word.partOfSpeech);
}
function CancelEditForm(index) {
@@ -160,7 +161,7 @@ function EditWord(indexString) {
function UpdateWord(wordIndex, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition) {
currentDictionary.words[wordIndex].name = word;
currentDictionary.words[wordIndex].pronunciation = pronunciation;
- currentDictionary.words[wordIndex].partOfSpeech = partOfSpeech;
+ currentDictionary.words[wordIndex].partOfSpeech = ((partOfSpeech.length > 0) ? partOfSpeech : " ");
currentDictionary.words[wordIndex].simpleDefinition = simpleDefinition;
currentDictionary.words[wordIndex].longDefinition = longDefinition;
@@ -690,13 +691,17 @@ function ImportWords() {
header: true,
step: function(row, parser) {
currentRow++;
- if (row.errors.length == 0) {
- currentDictionary.words.push({name: htmlEntities(row.data[0]["word"]).trim(), pronunciation: htmlEntities(row.data[0]["pronunciation"]).trim(), partOfSpeech: htmlEntities(row.data[0]["part of speech"]).trim(), simpleDefinition: htmlEntities(row.data[0]["equivalent"]).trim(), longDefinition: htmlEntities(row.data[0]["explanation"]).trim(), wordId: currentDictionary.nextWordId++});
+ // If there are no errors OR the word and either equivalent or explanation contain data, then import it.
+ if ((row.data[0].word.trim().length > 0 && (row.data[0].equivalent.trim().length > 0 || row.data[0].explanation.trim().length > 0)) || row.errors.length == 0) {
+ currentDictionary.words.push({name: htmlEntities(row.data[0]["word"]).trim(), pronunciation: htmlEntities(row.data[0]["pronunciation"]).trim(), partOfSpeech: ((htmlEntities(row.data[0]["part of speech"]).trim().length > 0) ? htmlEntities(row.data[0]["part of speech"]).trim() : " "), simpleDefinition: htmlEntities(row.data[0]["equivalent"]).trim(), longDefinition: htmlEntities(row.data[0]["explanation"]).trim(), wordId: currentDictionary.nextWordId++});
resultsArea.innerHTML += "Imported \"" + htmlEntitiesParse(htmlEntities(row.data[0]["word"])).trim() + "\" successfully
";
rowsImported++;
} else {
- for (var i = 0; i < row.errors.length; i++) {
- resultsArea.innerHTML += "Error on record #" + currentRow.toString() + ": " + row.errors[i].message + "
";
+ // If it's not just an empty line, give an error.
+ if (row.data[0].word.trim().length > 0) {
+ for (var i = 0; i < row.errors.length; i++) {
+ resultsArea.innerHTML += "Error on record #" + currentRow.toString() + ": " + row.errors[i].message + "
";
+ }
}
}
// Scroll to the bottom.
diff --git a/js/ui.js b/js/ui.js
index 6d0ed91..dba16d0 100644
--- a/js/ui.js
+++ b/js/ui.js
@@ -588,11 +588,17 @@ function SetPartsOfSpeech (selectId) {
var wordFiltersSelected = GetSelectedFilters();
// Clear parts of speech.
- for (var i = partsOfSpeechSelect.options.length - 1; i >= 0; i--) {
+ for (var i = partsOfSpeechSelect.options.length; i > 0; i--) {
partsOfSpeechSelect.removeChild(partsOfSpeechSelect.options[i]);
}
wordFilterOptions.innerHTML = "";
+ // Insert blank part of speech as first dropdown option.
+ var blankpartOfSpeechOption = document.createElement('option');
+ blankpartOfSpeechOption.appendChild(document.createTextNode(""));
+ blankpartOfSpeechOption.value = " ";
+ partsOfSpeechSelect.appendChild(blankpartOfSpeechOption);
+
// Rebuild parts of speech
var newPartsOfSpeech = htmlEntitiesParse(currentDictionary.settings.partsOfSpeech).trim().split(",");
for (var j = 0; j < newPartsOfSpeech.length; j++) {
@@ -614,6 +620,18 @@ function SetPartsOfSpeech (selectId) {
wordFilterLabel.appendChild(wordFilterCheckbox);
wordFilterOptions.appendChild(wordFilterLabel);
}
+
+ // Insert blank part of speech as last filter option
+ var blankwordFilterLabel = document.createElement('label');
+ blankwordFilterLabel.appendChild(document.createTextNode("Blanks "));
+ blankwordFilterLabel['part-of-speech'] = " ";
+ blankwordFilterLabel.className = 'filterOption';
+ var blankwordFilterCheckbox = document.createElement('input');
+ blankwordFilterCheckbox.type = 'checkbox';
+ blankwordFilterCheckbox.onchange = function(){ShowDictionary()};
+ if (wordFiltersSelected.indexOf(" ") > -1) blankwordFilterCheckbox.checked = true;
+ blankwordFilterLabel.appendChild(blankwordFilterCheckbox);
+ wordFilterOptions.appendChild(blankwordFilterLabel);
}
function GetSelectedFilters() {