5

I have a long list of vocabulary words which I wand to made some modification on it. the list is in the following form:

Word, Part of Speech, Word Forms
Synonyms
Word Definition
Sample Sentence

Word, Part of Speech, Word Forms
Synonyms
Word Definition
Sample Sentence

For example

Adorn, (verb) (adorns, adorning, adorned)
embellish, garnish, ornament, trim
For example, if someone adorns a place, he puts decorations on it.
His watercolor designs adorn a wide range of books.

Magnificent, (adjective) (magnificently, magnificence)
extraordinary, glorious, grand, splendid, superb, wonderful
For example, if you say that something or someone is magnificent, you mean that you think it is extremely good.
It is a magnificent country house in wooded grounds.

I want to make my list as follow:

Word
Synonyms


Word
Synonyms

like this

Adorn
embellish, garnish, ornament, trim


Magnificent
extraordinary, glorious, grand, splendid, superb, wonderful

I couldn't find the suitable commands in Replace

Thanks a lot for your help

2
  • Do you have a particular programming language that you'd like to use to accomplish this?
    – Kraigolas
    Aug 25, 2020 at 17:32
  • no, I thought it could be done only by "Find and Replace" in Microsoft office, or maybe a "Module", but if the use of a programming language is necessary, I know some basics of Java and Python Aug 25, 2020 at 17:36

3 Answers 3

6

In MS Word, press CTRL+H:

  • Find what: (*),*\(*\)(*^13)(*^13)*^13^13
  • Replace with: \1^13\3^13^13
  • Select "Use wildcards" among the Search Options.

Explanations:

  • (*),*\(*\)(*^13)(*^13)*^13^13: searches for the Word, the Part of Speech, etc., then finds the Synonym and everything up to 2 paragraph characters (^13^13).
  • \1^13\3^13^13: replaces what was found with the Word, a paragraph character, the Synonym and 2 paragraph characters

enter image description here

4
  • Thanks, your answer is so interesting too ;) Aug 25, 2020 at 20:30
  • I adopt your method, by I didn't succeed to use the seem technique to get: ```` Adorn (verb) embellish, garnish, ornament, trim ```` how I can change the previous code ? Thanks in advance Aug 25, 2020 at 21:43
  • 1
    @Almendrof66 You will need to change the first captured pattern on the find what box like this: (*),(*\(*\))(*^13)(*^13)*^13^13. The replace with will also change and becomes \1\2^13\4^13^13. Aug 26, 2020 at 5:44
  • Thanks a lot :)))) Aug 26, 2020 at 6:12
4

Using notepad++ on your example data:

Find what: ^([^\r\n\,]+)[^\r\n]*\r\n([^\r\n]+)\r\n[^\r\n]+\r\n[^\r\n]+$
Replace with: \1\r\n\2

Gives this:

enter image description here

2
  • Thanks a lot, you're a genius ;) Aug 25, 2020 at 20:04
  • 1
    This certainly works, but could you please expand on how it works?
    – Kraigolas
    Aug 25, 2020 at 23:27
2

Have you thought of importing it into a spreadsheet as a CSV? To make it easier to import, you'd need a different separator then the end-of-line characters (carriage return plus line feed, CR+LF, ASCII[13] + ASCII[10] in Windows OS) for each column, because you also use it to separate records, but that is easily fixed. The directions below apply to the free Notepad++ text editor, but similar capability is in most other test editors and word processors. Before you start, though make a backup copy of the original file so that you may revert to it if something goes wrong.

Notepad++ Serach & Replace

  • Search for CR/LF.
    • Press CtrlH to open the Replace dialog.
    • Enable Extended... character I/O.
    • Search for \r\n if using Windows newline convention.
    • Replace with \t, the tab character.
  • Now replace the doubled tabs, where you had double-spaced each record, with CR/LF. Follow the previous directions, but search for two tabs, \t\t, and replace with CR/LF, \r\n.

If you want to eliminate part of speech and word forms, you'd need to search and replace the beginning of each record from the first comma to the tab, since there are commas in the examples.

Save the file in Notepad++ with the extension .csv, which is a standard extension for "comma separated values", though here we used the Tab character, because tou do not seem to use it internally in your file.

Open the file with a spreadsheet, such as Excel from Microsoft Office, or free LibreOffice Calc, if you do not have MS Office. Set Tab as the column separator (CR/LF is always the record separator). The first column should be the base word, second column synonyms, and the third and fourth column, definition and sample sentence, can be deleted.

Calc .csv import

1
  • Thanks a lot for your effort, it's a good idea :)) Aug 25, 2020 at 20:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .