Regular expression for arabic text in matlab
古いコメントを表示
I used ocr in matlab to read arabic text from image.Now I want to write a regular expression that matches a word in arabic text but it does not work
19 件のコメント
Walter Roberson
2017 年 12 月 20 日
Could you give us some specific examples to experiment with?
N Rh
2017 年 12 月 21 日
Stephen23
2017 年 12 月 21 日
"...but it does not work"
This tells us nothing about what you have tried so far, nor about what the difference is between working/not working.
What have you tried? Do you get an output? How are you checking this output? If no output, do you get any error message?
N Rh
2017 年 12 月 21 日
Guillaume
2017 年 12 月 21 日
"it does not work"
As Stephen's said this is a useless statement if you don't even tell us what the "it" is. How can we know if you've made a mistake with the "it", or if you're using the "it" incorrectly, or if indeed the "it" does not support arabic.
So show us the "it", that is the exact code you're using and ideally an example input where "it" doesn't work.
Guillaume
2017 年 12 月 21 日
Seems to work for me (R2017b):
>> Pattern = '(فاتورة عدد)';
>> Lines = {Pattern(2:end-1); [Pattern(2:end-1), '2015/02 ']; Pattern(4:5)}
>> P = regexp(Lines,Pattern,'match');
>> P = [P{:}]
Lines =
3×1 cell array
{ فاتورة عدد'}
{'فاتورة عدد2015/02 '}
{ 'تو'}
P =
1×2 cell array
{'فاتورة عدد'} {'فاتورة عدد'}
N Rh
2017 年 12 月 21 日
Guillaume
2017 年 12 月 21 日
I don't think it is an issue with your matlab version as it also works for me in R2016a, R2016b and R2017a. It's probably more related to your operating system.
I'm using Win 7 (Enterprise) and didn't have to do anything special to get the above to work.
N Rh
2017 年 12 月 21 日
Walter Roberson
2017 年 12 月 21 日
One thing to note is that if your operating system is set to English, then MATLAB might not store .m files with UTF encoding, so when you save the .m file and close it and open it again, any arabic characters you had in the file might be gone. With newer versions there is apparently a way to force MATLAB to permit UTF-8 for .m files, but it involves editing an obscure configuration file.
Walter Roberson
2017 年 12 月 21 日
Just to be sure we are all referring to the same thing:
It is not possible to use regexp() on an image, only on character vectors or cell array of character vectors or on string() arrays.
N Rh
2017 年 12 月 21 日
Walter Roberson
2017 年 12 月 21 日
Please attach a .mat containing the cell array and also containing the pattern you are trying to search for.
N Rh
2017 年 12 月 21 日
編集済み: Walter Roberson
2017 年 12 月 21 日
Walter Roberson
2017 年 12 月 21 日
I had to hunt around for the arabic training files for tessaract; perhaps I did not find the right ones. And I got a whole bunch of messages about
Cube ERROR (ConvNetCharClassifier::RunNets): NeuralNet is NULL
The output.txt file contained only English for me.
N Rh
2017 年 12 月 21 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Text Detection and Recognition についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!