array('new', 'brand new', 'unused', 'uusi', 'kayttamaton', 'ny', 'oanvand', 'neu', 'ungebraucht', 'neuf', 'nuovo', 'nuevo', 'nowy', 'nieuw'), 'like_new' => array('like new', 'as new', 'mint', 'kuin uusi', 'uudenveroinen', 'nyskick', 'som ny', 'wie neu', 'neuwertig', 'comme neuf', 'come nuovo', 'como nuevo', 'jak nowy', 'zo goed als nieuw', 'como novo'), 'excellent' => array('excellent', 'very good', 'near mint', 'erinomainen', 'erittain hyva', 'mycket bra', 'mycket gott skick', 'sehr gut', 'tres bon', 'ottimo', 'muy bueno', 'bardzo dobry', 'zeer goed', 'excelente', 'uitstekend', 'muito bom', 'mycket gott', 'tres bon etat'), 'good' => array('good', 'hyva', 'bra', 'gott skick', 'gut', 'bon', 'buono', 'bueno', 'dobry', 'goed', 'bom', 'bon etat', 'gott', 'buen estado'), 'fair' => array('fair', 'acceptable', 'well used', 'valttava', 'tyydyttava', 'kohtalainen', 'ok', 'okej', 'godtagbart', 'akzeptabel', 'correct', 'discreto', 'aceptable', 'dostateczny', 'redelijk', 'razoavel'), 'parts' => array('for parts', 'parts', 'not working', 'broken', 'faulty', 'spares or repair', 'rikki', 'varaosiksi', 'rikki/varaosiksi', 'viallinen', 'for reservdelar', 'trasig', 'defekt', 'pour pieces', 'per ricambi', 'para piezas', 'uszkodzony', 'defect', 'fur teile', 'na czesci', 'voor onderdelen', 'para pecas'), ); $text = ' ' . preg_replace('/[^a-z0-9\/]+/', ' ', usedkit_fold($label)) . ' '; $best = ''; $len = 0; foreach ($words as $grade => $list) { foreach ($list as $w) { if (strlen($w) > $len && strpos($text, ' ' . $w . ' ') !== false) { $best = $grade; $len = strlen($w); } } } return $best; } /** "Box, charger, two batteries" as a list, empty items out. */ function usedkit_split_list($text) { return array_values(array_filter(array_map('trim', preg_split('/[,;\n]+/', (string) $text)), 'strlen')); }