You can search for concepts by name, even in a different language using the concept searches endpoint:
importcom.clarifai.grpc.api.*;importcom.clarifai.grpc.api.status.*;// Insert here the initialization code as outlined on this page:// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructionsMultiConceptResponse postConceptsSearchesResponse =stub.postConceptsSearches(PostConceptsSearchesRequest.newBuilder().setConceptQuery(ConceptQuery.newBuilder().setName("人").setLanguage("ja")).build());if(postConceptsSearchesResponse.getStatus().getCode()!=StatusCode.SUCCESS){thrownewRuntimeException("Post concepts searches failed, status: "+postConceptsSearchesResponse.getStatus());}System.out.println("Found concepts:");for(Concept concept :postConceptsSearchesResponse.getConceptsList()){System.out.printf("\t%s %.2f%n",concept.getName(),concept.getValue());}
using System.Threading.Tasks;
using Clarifai.API;
namespace YourNamespace
{
public class YourClassName
{
public static async Task Main()
{
var client = new ClarifaiClient("YOUR_API_KEY");
await client.SearchConcepts(
"人*",
language: "zh")
.Page(1)
.ExecuteAsync();
}
}
}
// Search for all concept names in chinese, beginning with "人".
[_app searchForConceptsByName:@"人*" andLanguage:@"zh" completion:^(NSArray<ClarifaiConcept *> *concepts, NSError *error) {
for (ClarifaiConcept *concept in concepts) {
NSLog(@"tag name: %@", concept.conceptName);
}
}];
use Clarifai\API\ClarifaiClient;
use Clarifai\DTOs\Predictions\Concept;
$client = new ClarifaiClient();
$response = $client->searchConcepts('人*')
->withLanguage('zh')
->executeSync();
if ($response->isSuccessful()) {
echo "Response is successful.\n";
$concepts = $response->get();
foreach ($concepts as $concept) {
echo $concept->name() . ' ' . $concept->value() . "\n";
}
} else {
echo "Response is not successful. Reason: \n";
echo $response->status()->description() . "\n";
echo $response->status()->errorDetails() . "\n";
echo "Status code: " . $response->status()->statusCode();
}