6

I am working on a commentary on Ethics of the Fathers and I want readers to be able to read sources I'm quoting in their original Hebrew. I am getting most of my sources from sefaria.org and unfortunately many of the sources have Nekudos (vowel marks) while most of them don't. For consistency and professionalism I want all the sources to not contain Nekudos.

For example this line: מֹשֶׁה קִבֵּל תּוֹרָה מִסִּינַי. אוֹמֵר אֲנִי, לְפִי שֶׁמַּסֶּכֶת זוֹ should be משה קבל תורה מסיני. אומר אני שמסכת זו. I expect to need to do this hundreds of times so I need something fast. Somebody once made me a document with Macros to do this but it isn't working on Word 2016. Does anyone else have an efficient way to do it? Thank you so much.

  • 2
    Can someone please add Hebrew as a tag? I can't do it yet. Thanks. – Eliyahu Jan 10 '18 at 21:03
  • Did you try notepad++? – Boondoggle Jan 10 '18 at 23:28
  • Added a few tags. Does that help? You may want to try looking in the Hebrew community or the SuperUser community of stack Exchange. I wish I could find a direct link to either community, but I did quickly come across this question. Not sure if it is relevant. superuser.com/questions/769204/hebrew-nikkud-on-ms-word – BugFolk Jan 10 '18 at 23:46
  • 1
    @BugFolk I've changed the tags to include [microsoft-word] and [formatting]. Hebrew is not viable as a tag, because while the question is about vowel marks on Hebrew, it could easily apply to any language. Plus 'Hebrew' is not a tag, and it's good practice to avoid creating tags whenever possible. Similarly, the tags [software] and [language] did not fit the question, which was not asking about a language, nor specifically about software. The OP was asking about MS Word specifically, so that's a far better tag than 'software'. – Thomas Myron Jan 11 '18 at 0:34
  • Okay. Good to know. – BugFolk Jan 11 '18 at 3:01
3

A quick Google search on hebrew remove nikkud gave an answer.

On Github there's a JavaScript with a live preview code. If it's little text you could use the JavaScript either online or download and use it on your pc (save as .js).

The Hebrew charcodes are all between 1425 and 1479 and the nikkud are between 0591 and 05C7.

Python implementation (tested):

import unicodedata
# nikkud-test.txt is the file you save your text in.
f= open('nikkud-test.txt','r', encoding='utf-8') 
content = f.read()
normalized=unicodedata.normalize('NFKD', content)
no_nikkud=''.join([c for c in normalized if not unicodedata.combining(c)])
no_nikkud
f.close()
f = open('no-nikkud-test.txt','w',encoding='utf-8')
fw = f.write(no_nikkud)
f.close()

This works very fast.

UPDATED: How to use this script?

  1. Download Python 3.x.x from the python.org
  2. Save your nikkud text to nikkud-test.txt in whatever directory
  3. From the start menu start your cmd shell/command prompt/terminal.
  4. Move to directory where you saved your file by typing cd followed by the directory
  5. type python or open an iPython console.
  6. copy + paste script
  7. no-nikkud-test.txt will show up in the same directory

UPDATE without Terminal (Tested with Python 3.5 IDLE and iPython)

  1. Download Python 3.5 or higher from python.org
  2. Save your niqqud text to niqqud.txt in your Documents folder. (Windows / Mac)
  3. Open IDLE from the Start Menu. (Alternatively, use iPython)

Copy and paste the function below:

def hasar_niqqud(source="niqqud.txt"):
    """This function removes niqqud vowel diacretics from Hebrew.
    @param source: The source filename with .txt extension."""
    import os, unicodedata
    path  = os.path.expanduser('~/Documents/'+str(source))
    f= open(path,'r', encoding='utf-8')
    content = f.read()
    normalized=unicodedata.normalize('NFKD', content)
    no_niqqud=''.join([c for c in normalized if not unicodedata.combining(c)])
    f.close()
    path  = os.path.expanduser('~/Documents/'+str(source)[:-4]+"-removed.txt")
    f = open(path,'w',encoding='utf-8')
    f.write(no_niqqud)
    f.close()

Then run the function with this code:

hasar_niqqud()

That's it! You can find the output in the Documents folder niqqud-removed.txt

  • 2
    Thank you so much. I'm not familiar with coding. How do I use this? – Eliyahu Jan 11 '18 at 2:40
  • 2
    For those of us who are technically challenged, could you explain where to download Python3 and how to start a cmd shell? – Thomas Myron Jan 11 '18 at 6:20
  • 1
    Updated. The command prompt is also called terminal on other systems. It is not as hard as it seems. It's just a little overwhelming at first. – Boondoggle Jan 11 '18 at 6:52
  • I don't know. I spent a while trying to follow these instructions and I keep getting error codes. I really know nothing about using these kinds of programs. – Eliyahu Jan 12 '18 at 4:09
  • Try installing iPython ipython.org/install.html It has a better interface than the terminal. – Boondoggle Jan 13 '18 at 17:15
4

I was looking for the exact same thing. Dug around and found ways to do it outside Word, but really wanted to do this without leaving Word. Did some more reading and discovered the key is to run a find and replace, searching for the vowel characters in the Hebrew Unicode block. I wanted to keep maqqef and sof pasuq, so I had to use three separate ranges (if you don't want those characters, you can simplify this to one search for the whole range 1425-1479). The results are below. If you select text and run the macro, it will only apply to the selection. If you don't have a selection, it will run to end of document.

Sub HebrewDevocalizer()
With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[" & ChrW(1425) & "-" & ChrW(1469) & "]"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchKashida = False
    .MatchDiacritics = False
    .MatchAlefHamza = False
    .MatchControl = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[" & ChrW(1471) & "-" & ChrW(1474) & "]"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchKashida = False
    .MatchDiacritics = False
    .MatchAlefHamza = False
    .MatchControl = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[" & ChrW(1476) & "-" & ChrW(1479) & "]"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchKashida = False
    .MatchDiacritics = False
    .MatchAlefHamza = False
    .MatchControl = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
2

In case your list is in Excel you could use this macro (based on the suggestion of Jonathan Potter). Select a range of cells, then execute the macro in VBEditor.

Sub HebrewDevocalizer()
Dim i As Integer

    For i = 1425 To 1469
        Selection.Replace What:=ChrW(i), Replacement:="", LookAt:=xlPart, _
            SearchOrder:=xlByColumns, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    Next i
    For i = 1471 To 1474
        Selection.Replace What:=ChrW(i), Replacement:="", LookAt:=xlPart, _
            SearchOrder:=xlByColumns, MatchCase:=False
    Next i
    For i = 1476 To 1479
        Selection.Replace What:=ChrW(i), Replacement:="", LookAt:=xlPart, _
            SearchOrder:=xlByColumns, MatchCase:=False
    Next i

End Sub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.