Answer the question
In order to leave comments, you need to log in
How to parse a catalog of books?
The library has a large book catalog. Here are three lines from it:
Arthur Conan Doyle – The Adventures of Sherlock Holmes, George Newnes 1892
Ernest Hemingway – The Old Man and the Sea, Charles Scribner's Sons 1952
Ralph Leighton, Richard Feynman – Surely You're Joking, Mr. Feynman!, W.W. Norton 1985
Answer the question
In order to leave comments, you need to log in
Is this always the same format? then you can stupidly in the forehead in a cycle
s = 'Arthur Conan Doyle – The Adventures of Sherlock Holmes, George Newnes 1892'
author = s.split('–')[0].trim()
by = s.split('–')[1].trim()
last = by.lastIndexOf(' ')
book = by.slice(0, l).trim()
year = by.slice(l).trim()
I am sure that the regular season will definitely help here. There will be something like preg_match('/(.*)-(.*),(.*)/', .... $kek)
$kek[0] - Author, etc.
And try the coolest method for pride :) If there is and will be an opportunity.
Use the FANN library
https://www.php.net/manual/ru/book.fann.php
And here is the tutorial https://phpnick.ru/posts/category/php/48
Make a small dataset by analogy
And now you have an artificial intelligence that parses books :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question