Hello! thanks for "dartpy"!
USING: https://github.com/natasha/natasha
CODE:
import 'dart:ffi';
import 'package:dartpy/dartpy.dart';
import 'package:ffi/ffi.dart';
void main(List args) {
pyLibLocation = 'C:\Python312\python312.dll';
dartpyc.Py_Initialize();
final python = '''
from natasha import AddressExtractor
extractor = AddressExtractor()
addresses = """
Абрамцевская улица, дом 16 Б
ул. Абрамцевская, д.3
ул Абрамцевская 5
Абрамцевская ул., 5/2
""".strip().splitlines()
for address in addresses:
matches = extractor(address)
for match in matches:
print(match.fact)
''';
final pystring = python.toNativeUtf8();
dartpyc.PyRun_SimpleString(pystring.cast());
malloc.free(pystring);
print(dartpyc.Py_FinalizeEx());
}
Address(parts=[Street(name='������������', type='�����'), Building(number='16 �', type='���')])
Address(parts=[Street(name='������������', type='�����'), Building(number='3', type='���')])
Address(parts=[Street(name='������������', type='�����'), Building(number='5', type=None)])
Address(parts=[Street(name='������������', type='�����'), Building(number='5/2', type=None)])
Address(parts=[Street(name='Абрамцевская', type='улица'), Building(number='16 Б', type='дом')])
Address(parts=[Street(name='Абрамцевская', type='улица'), Building(number='3', type='дом')])
Address(parts=[Street(name='Абрамцевская', type='улица'), Building(number='5', type=None)])
Address(parts=[Street(name='Абрамцевская', type='улица'), Building(number='5/2', type=None)])