
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@sharpapi/sharpapi-node-hospitality-categories
Advanced tools
SharpAPI.com Node.js SDK for generating hospitality product categories

SharpAPI Hospitality Product Categorization uses AI to automatically categorize hotels, resorts, vacation rentals, and other hospitality products based on their descriptions. Perfect for travel platforms, booking systems, and hospitality management tools.
npm install @sharpapi/sharpapi-node-hospitality-categories
Visit SharpAPI.com to get your API key.
const { SharpApiHospitalityCategoriesService } = require('@sharpapi/sharpapi-node-hospitality-categories');
const apiKey = process.env.SHARP_API_KEY;
const service = new SharpApiHospitalityCategoriesService(apiKey);
const propertyDescription = `
Luxury beachfront resort with private villas, infinity pool, spa,
and fine dining restaurant. All-inclusive package available.
Perfect for romantic getaways and honeymoons.
`;
async function categorizeProperty() {
try {
const statusUrl = await service.categorizeProduct(propertyDescription);
console.log('Job submitted. Status URL:', statusUrl);
const result = await service.fetchResults(statusUrl);
console.log('Categories:', result.getResultJson());
} catch (error) {
console.error('Error:', error.message);
}
}
categorizeProperty();
categorizeProduct(productDescription: string, maxCategories?: number): Promise<string>Categorizes a hospitality product based on its description.
Parameters:
productDescription (string, required): The property/product description to categorizemaxCategories (number, optional): Maximum number of categories to return (default: 5)Returns:
The API returns categories with relevance scores (weight: 0-10):
{
"categories": [
{
"name": "Luxury Beach Resort",
"weight": 10,
"subcategories": ["All-Inclusive", "Spa Resort", "Romantic Getaway"]
},
{
"name": "Boutique Hotel",
"weight": 7,
"subcategories": ["Beachfront", "Adults Only"]
},
{
"name": "Honeymoon Destination",
"weight": 9,
"subcategories": ["Romantic", "Luxury"]
}
]
}
Weight Scale:
10: Perfect match8-9: Highly relevant6-7: Moderately relevant4-5: Somewhat relevant1-3: Slightly relevantconst { SharpApiHospitalityCategoriesService } = require('@sharpapi/sharpapi-node-hospitality-categories');
const service = new SharpApiHospitalityCategoriesService(process.env.SHARP_API_KEY);
const property = 'Budget-friendly city hotel near train station with free WiFi and breakfast';
service.categorizeProduct(property)
.then(statusUrl => service.fetchResults(statusUrl))
.then(result => {
const categories = result.getResultJson();
console.log('📂 Property Categories:');
categories.forEach((cat, index) => {
console.log(`${index + 1}. ${cat.name} (relevance: ${cat.weight}/10)`);
if (cat.subcategories) {
console.log(` Subcategories: ${cat.subcategories.join(', ')}`);
}
});
})
.catch(error => console.error('Categorization failed:', error));
const service = new SharpApiHospitalityCategoriesService(process.env.SHARP_API_KEY);
const properties = [
'Mountain ski lodge with heated pool and après-ski bar',
'Downtown business hotel with conference facilities and gym',
'Family-friendly resort with kids club and water park',
'Historic boutique hotel in restored Victorian mansion'
];
async function categorizeAll(properties) {
const categorized = await Promise.all(
properties.map(async (property) => {
const statusUrl = await service.categorizeProduct(property, 3);
const result = await service.fetchResults(statusUrl);
const categories = result.getResultJson();
return {
property,
primary_category: categories[0]?.name,
all_categories: categories.map(c => c.name)
};
})
);
return categorized;
}
const results = await categorizeAll(properties);
console.log('Categorized properties:', results);
const service = new SharpApiHospitalityCategoriesService(process.env.SHARP_API_KEY);
async function enrichPropertyListing(property) {
const fullDescription = `
${property.name}
${property.description}
Amenities: ${property.amenities.join(', ')}
Location: ${property.location}
`;
const statusUrl = await service.categorizeProduct(fullDescription);
const result = await service.fetchResults(statusUrl);
const categories = result.getResultJson();
// Get high-relevance categories
const primaryCategories = categories
.filter(cat => cat.weight >= 7)
.map(cat => cat.name);
// Extract tags from subcategories
const tags = categories
.flatMap(cat => cat.subcategories || [])
.filter((tag, index, self) => self.indexOf(tag) === index);
return {
...property,
categories: primaryCategories,
tags: tags,
searchable_text: [...primaryCategories, ...tags].join(' '),
categorization_confidence: categories[0]?.weight || 0
};
}
const property = {
id: 'PROP-12345',
name: 'Seaside Paradise Resort',
description: 'Luxury oceanfront resort with private beach',
amenities: ['Pool', 'Spa', 'Restaurant', 'Bar'],
location: 'Cancun, Mexico'
};
const enrichedProperty = await enrichPropertyListing(property);
console.log('Enriched listing:', enrichedProperty);
const service = new SharpApiHospitalityCategoriesService(process.env.SHARP_API_KEY);
async function generateSearchFilters(propertyDescriptions) {
const allCategories = new Map();
for (const description of propertyDescriptions) {
const statusUrl = await service.categorizeProduct(description);
const result = await service.fetchResults(statusUrl);
const categories = result.getResultJson();
categories.forEach(cat => {
if (!allCategories.has(cat.name)) {
allCategories.set(cat.name, 0);
}
allCategories.set(cat.name, allCategories.get(cat.name) + 1);
});
}
// Convert to filter options
const filters = Array.from(allCategories.entries())
.map(([category, count]) => ({
value: category.toLowerCase().replace(/\s+/g, '_'),
label: category,
count: count
}))
.sort((a, b) => b.count - a.count);
return filters;
}
const sampleDescriptions = [
'Beach resort with water sports...',
'Mountain lodge with skiing...',
'City hotel with conference rooms...'
];
const searchFilters = await generateSearchFilters(sampleDescriptions);
console.log('Available search filters:', searchFilters);
The system recognizes various property types:
Accommodation Types:
Specialized Categories:
Purpose-Based:
POST /tth/hospitality_product_categories
For detailed API specifications, refer to:
This project is licensed under the MIT License. See the LICENSE.md file for details.
Powered by SharpAPI - AI-Powered API Workflow Automation
FAQs
SharpAPI.com Node.js SDK for generating hospitality product categories
The npm package @sharpapi/sharpapi-node-hospitality-categories receives a total of 1 weekly downloads. As such, @sharpapi/sharpapi-node-hospitality-categories popularity was classified as not popular.
We found that @sharpapi/sharpapi-node-hospitality-categories demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.