Yapay Zeka Destekli Özetler

Tam örnek kaynak kodunu görüntüleme

Yapay zeka destekli özetleri görmek için yer arayın. Önerilen aramalardan bazıları:

  • Mahalle özetleri için "Otel".
  • EVCS tesis özetleri için "Elektrikli araç şarj istasyonu".
  • Yer ve yorum özetleri için herhangi bir restoran veya işletme.

TypeScript

// Define DOM elements.
const mapElement = document.querySelector('gmp-map') as google.maps.MapElement;
const placeAutocomplete = document.querySelector(
    'gmp-place-autocomplete'
) as google.maps.places.PlaceAutocompleteElement;
const summaryPanel = document.getElementById('summary-panel') as HTMLDivElement;
const placeName = document.getElementById('place-name') as HTMLElement;
const placeAddress = document.getElementById('place-address') as HTMLElement;
const tabContainer = document.getElementById('tab-container') as HTMLDivElement;
const summaryContent = document.getElementById(
    'summary-content'
) as HTMLDivElement;
const aiDisclosure = document.getElementById('ai-disclosure') as HTMLDivElement;
const flagContentLink = document.getElementById('flag-content-link') as HTMLAnchorElement;

let innerMap;
let marker: google.maps.marker.AdvancedMarkerElement;

async function initMap(): Promise<void> {
    // Request needed libraries.
    const [] = await Promise.all([
        google.maps.importLibrary('marker'),
        google.maps.importLibrary('places'),
    ]);

    innerMap = mapElement.innerMap;
    innerMap.setOptions({
        mapTypeControl: false,
        streetViewControl: false,
        fullscreenControl: false,
    });

    // Bind autocomplete bounds to map bounds.
    google.maps.event.addListener(innerMap, 'bounds_changed', async () => {
        placeAutocomplete.locationRestriction = innerMap.getBounds();
    });

    // Create the marker.
    marker = new google.maps.marker.AdvancedMarkerElement({
        map: innerMap,
    });

    // Handle selection of an autocomplete result.
    // prettier-ignore
    // @ts-ignore
    placeAutocomplete.addEventListener('gmp-select', async ({ placePrediction }) => {
            const place = placePrediction.toPlace();

            // Fetch all summary fields.
            await place.fetchFields({
                fields: [
                    'displayName',
                    'formattedAddress',
                    'location',
                    'generativeSummary',
                    'neighborhoodSummary',
                    'reviewSummary',
                    'evChargeAmenitySummary',
                ],
            });

            // Update the map viewport and position the marker.
            if (place.viewport) {
                innerMap.fitBounds(place.viewport);
            } else {
                innerMap.setCenter(place.location);
                innerMap.setZoom(17);
            }
            marker.position = place.location;

            // Update the panel UI.
            updateSummaryPanel(place);
        }
    );
}

function updateSummaryPanel(place: google.maps.places.Place) {
    // Reset UI
    summaryPanel.classList.remove('hidden');
    tabContainer.innerHTML = ''; // innerHTML is OK here since we're clearing known child elements.
    summaryContent.textContent = '';
    aiDisclosure.textContent = '';

    placeName.textContent = place.displayName || '';
    placeAddress.textContent = place.formattedAddress || '';

    let firstTabActivated = false;

    /**
     * Safe Helper: Accepts either a text string or a DOM Node (like a div or DocumentFragment).
     */
    const createTab = (
        label: string,
        content: string | Node,
        disclosure: string,
        flagUrl: string
    ) => {
        const btn = document.createElement('button');
        btn.className = 'tab-button';
        btn.textContent = label;

        btn.onclick = () => {
            // Do nothing if the tab is already active.
            if (btn.classList.contains('active')) {
                return;
            }

            // Manage the active class state.
            document
                .querySelectorAll('.tab-button')
                .forEach((b) => b.classList.remove('active'));
            btn.classList.add('active');

            if (typeof content === 'string') {
                summaryContent.textContent = content;
            } else {
                summaryContent.replaceChildren(content.cloneNode(true));
            }

            // Set the disclosure text.
            aiDisclosure.textContent = disclosure || 'AI-generated content.';

            // Add the content flag URI.
            if (flagUrl) {
                flagContentLink.href = flagUrl;
                flagContentLink.textContent = "Report an issue"
            }
        };

        tabContainer.appendChild(btn);

        // Auto-select the first available summary.
        if (!firstTabActivated) {
            btn.click();
            firstTabActivated = true;
        }
    };

    // --- 1. Generative Summary (Place) ---
    //@ts-ignore
    if (place.generativeSummary?.overview) {
        createTab(
            'Overview',
            //@ts-ignore
            place.generativeSummary.overview,
            //@ts-ignore
            place.generativeSummary.disclosureText,
            //@ts-ignore
            place.generativeSummary.flagContentURI
        );
    }

    // --- 2. Review Summary ---
    //@ts-ignore
    if (place.reviewSummary?.text) {
        createTab(
            'Reviews',
            //@ts-ignore
            place.reviewSummary.text,
            //@ts-ignore
            place.reviewSummary.disclosureText,
            //@ts-ignore
            place.reviewSummary.flagContentURI
        );
    }

    // --- 3. Neighborhood Summary ---
    //@ts-ignore
    if (place.neighborhoodSummary?.overview?.content) {
        createTab(
            'Neighborhood',
            //@ts-ignore
            place.neighborhoodSummary.overview.content,
            //@ts-ignore
            place.neighborhoodSummary.disclosureText,
            //@ts-ignore
            place.neighborhoodSummary.flagContentURI
        );
    }

    // --- 4. EV Amenity Summary (uses content blocks)) ---
    //@ts-ignore
    if (place.evChargeAmenitySummary) {
        //@ts-ignore
        const evSummary = place.evChargeAmenitySummary;
        const evContainer = document.createDocumentFragment();

        // Helper to build a safe DOM section for EV categories.
        const createSection = (title: string, text: string) => {
            const wrapper = document.createElement('div');
            wrapper.style.marginBottom = '15px'; // Or use a CSS class

            const titleEl = document.createElement('strong');
            titleEl.textContent = title;

            const textEl = document.createElement('div');
            textEl.textContent = text;

            wrapper.appendChild(titleEl);
            wrapper.appendChild(textEl);
            return wrapper;
        };

        // Check and append each potential section
        if (evSummary.overview?.content) {
            evContainer.appendChild(
                createSection('Overview', evSummary.overview.content)
            );
        }
        if (evSummary.coffee?.content) {
            evContainer.appendChild(
                createSection('Coffee', evSummary.coffee.content)
            );
        }
        if (evSummary.restaurant?.content) {
            evContainer.appendChild(
                createSection('Food', evSummary.restaurant.content)
            );
        }
        if (evSummary.store?.content) {
            evContainer.appendChild(
                createSection('Shopping', evSummary.store.content)
            );
        }

        // Only add the tab if the container has children
        if (evContainer.hasChildNodes()) {
            createTab(
                'EV Amenities',
                evContainer, // Passing a Node instead of string
                evSummary.disclosureText,
                evSummary.flagContentURI
            );
        }
    }

    // Safely handle the empty state.
    if (!firstTabActivated) {
        const msg = document.createElement('em');
        msg.textContent =
            'No AI summaries are available for this specific location.';
        summaryContent.replaceChildren(msg);
        aiDisclosure.textContent = '';
    }
}

initMap();

JavaScript

// Define DOM elements.
const mapElement = document.querySelector('gmp-map');
const placeAutocomplete = document.querySelector('gmp-place-autocomplete');
const summaryPanel = document.getElementById('summary-panel');
const placeName = document.getElementById('place-name');
const placeAddress = document.getElementById('place-address');
const tabContainer = document.getElementById('tab-container');
const summaryContent = document.getElementById('summary-content');
const aiDisclosure = document.getElementById('ai-disclosure');
const flagContentLink = document.getElementById('flag-content-link');
let innerMap;
let marker;
async function initMap() {
    // Request needed libraries.
    const [] = await Promise.all([
        google.maps.importLibrary('marker'),
        google.maps.importLibrary('places'),
    ]);
    innerMap = mapElement.innerMap;
    innerMap.setOptions({
        mapTypeControl: false,
        streetViewControl: false,
        fullscreenControl: false,
    });
    // Bind autocomplete bounds to map bounds.
    google.maps.event.addListener(innerMap, 'bounds_changed', async () => {
        placeAutocomplete.locationRestriction = innerMap.getBounds();
    });
    // Create the marker.
    marker = new google.maps.marker.AdvancedMarkerElement({
        map: innerMap,
    });
    // Handle selection of an autocomplete result.
    // prettier-ignore
    // @ts-ignore
    placeAutocomplete.addEventListener('gmp-select', async ({ placePrediction }) => {
        const place = placePrediction.toPlace();
        // Fetch all summary fields.
        await place.fetchFields({
            fields: [
                'displayName',
                'formattedAddress',
                'location',
                'generativeSummary',
                'neighborhoodSummary',
                'reviewSummary',
                'evChargeAmenitySummary',
            ],
        });
        // Update the map viewport and position the marker.
        if (place.viewport) {
            innerMap.fitBounds(place.viewport);
        }
        else {
            innerMap.setCenter(place.location);
            innerMap.setZoom(17);
        }
        marker.position = place.location;
        // Update the panel UI.
        updateSummaryPanel(place);
    });
}
function updateSummaryPanel(place) {
    // Reset UI
    summaryPanel.classList.remove('hidden');
    tabContainer.innerHTML = ''; // innerHTML is OK here since we're clearing known child elements.
    summaryContent.textContent = '';
    aiDisclosure.textContent = '';
    placeName.textContent = place.displayName || '';
    placeAddress.textContent = place.formattedAddress || '';
    let firstTabActivated = false;
    /**
     * Safe Helper: Accepts either a text string or a DOM Node (like a div or DocumentFragment).
     */
    const createTab = (label, content, disclosure, flagUrl) => {
        const btn = document.createElement('button');
        btn.className = 'tab-button';
        btn.textContent = label;
        btn.onclick = () => {
            // Do nothing if the tab is already active.
            if (btn.classList.contains('active')) {
                return;
            }
            // Manage the active class state.
            document
                .querySelectorAll('.tab-button')
                .forEach((b) => b.classList.remove('active'));
            btn.classList.add('active');
            if (typeof content === 'string') {
                summaryContent.textContent = content;
            }
            else {
                summaryContent.replaceChildren(content.cloneNode(true));
            }
            // Set the disclosure text.
            aiDisclosure.textContent = disclosure || 'AI-generated content.';
            // Add the content flag URI.
            if (flagUrl) {
                flagContentLink.href = flagUrl;
                flagContentLink.textContent = "Report an issue";
            }
        };
        tabContainer.appendChild(btn);
        // Auto-select the first available summary.
        if (!firstTabActivated) {
            btn.click();
            firstTabActivated = true;
        }
    };
    // --- 1. Generative Summary (Place) ---
    //@ts-ignore
    if (place.generativeSummary?.overview) {
        createTab('Overview', 
        //@ts-ignore
        place.generativeSummary.overview, 
        //@ts-ignore
        place.generativeSummary.disclosureText, 
        //@ts-ignore
        place.generativeSummary.flagContentURI);
    }
    // --- 2. Review Summary ---
    //@ts-ignore
    if (place.reviewSummary?.text) {
        createTab('Reviews', 
        //@ts-ignore
        place.reviewSummary.text, 
        //@ts-ignore
        place.reviewSummary.disclosureText, 
        //@ts-ignore
        place.reviewSummary.flagContentURI);
    }
    // --- 3. Neighborhood Summary ---
    //@ts-ignore
    if (place.neighborhoodSummary?.overview?.content) {
        createTab('Neighborhood', 
        //@ts-ignore
        place.neighborhoodSummary.overview.content, 
        //@ts-ignore
        place.neighborhoodSummary.disclosureText, 
        //@ts-ignore
        place.neighborhoodSummary.flagContentURI);
    }
    // --- 4. EV Amenity Summary (uses content blocks)) ---
    //@ts-ignore
    if (place.evChargeAmenitySummary) {
        //@ts-ignore
        const evSummary = place.evChargeAmenitySummary;
        const evContainer = document.createDocumentFragment();
        // Helper to build a safe DOM section for EV categories.
        const createSection = (title, text) => {
            const wrapper = document.createElement('div');
            wrapper.style.marginBottom = '15px'; // Or use a CSS class
            const titleEl = document.createElement('strong');
            titleEl.textContent = title;
            const textEl = document.createElement('div');
            textEl.textContent = text;
            wrapper.appendChild(titleEl);
            wrapper.appendChild(textEl);
            return wrapper;
        };
        // Check and append each potential section
        if (evSummary.overview?.content) {
            evContainer.appendChild(createSection('Overview', evSummary.overview.content));
        }
        if (evSummary.coffee?.content) {
            evContainer.appendChild(createSection('Coffee', evSummary.coffee.content));
        }
        if (evSummary.restaurant?.content) {
            evContainer.appendChild(createSection('Food', evSummary.restaurant.content));
        }
        if (evSummary.store?.content) {
            evContainer.appendChild(createSection('Shopping', evSummary.store.content));
        }
        // Only add the tab if the container has children
        if (evContainer.hasChildNodes()) {
            createTab('EV Amenities', evContainer, // Passing a Node instead of string
            evSummary.disclosureText, evSummary.flagContentURI);
        }
    }
    // Safely handle the empty state.
    if (!firstTabActivated) {
        const msg = document.createElement('em');
        msg.textContent =
            'No AI summaries are available for this specific location.';
        summaryContent.replaceChildren(msg);
        aiDisclosure.textContent = '';
    }
}
initMap();

CSS

/* Reuse existing map height */
gmp-map {
    height: 100%;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Existing Autocomplete Card Style */
.place-autocomplete-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    margin: 10px;
    padding: 15px;
    font-family: Roboto, sans-serif;
    font-size: 1rem;
}

gmp-place-autocomplete {
    width: 300px;
}

/* New: Summary Panel Styles */
.summary-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    margin: 10px;
    padding: 0; /* Padding handled by children */
    font-family: Roboto, sans-serif;
    width: 350px;
    max-height: 80vh; /* Prevent overflow on small screens */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none;
}

#place-header {
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

#place-header h2 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
}

#place-address {
    margin: 0;
    color: #555;
    font-size: 0.9rem;
}

/* Tab Navigation */
.tab-container {
    display: flex;
    border-bottom: 1px solid #ddd;
    background-color: #fff;
}

.tab-button {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background-color: #f1f1f1;
}

.tab-button.active {
    font-weight: bold;
    border-bottom: 3px solid #000000;
}

.tab-button.active:hover {
    background-color: #ffffff;
    cursor: default;
}

/* Content Area */
.content-area {
    padding: 15px;
    line-height: 1.5;
    font-size: 0.95rem;
    color: #333;
}

.disclosure-footer {
    font-size: 0.75rem;
    color: #666;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    font-style: italic;
}

.flag-content-link {
    font-size: 0.75rem;
    color: #666;
    padding: 10px 15px;
    border-top: 1px solid #eee;
}
/* Reuse existing map height */
gmp-map {
    height: 100%;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Existing Autocomplete Card Style */
.place-autocomplete-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    margin: 10px;
    padding: 15px;
    font-family: Roboto, sans-serif;
    font-size: 1rem;
}

gmp-place-autocomplete {
    width: 300px;
}

/* New: Summary Panel Styles */
.summary-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    margin: 10px;
    padding: 0; /* Padding handled by children */
    font-family: Roboto, sans-serif;
    width: 350px;
    max-height: 80vh; /* Prevent overflow on small screens */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none;
}

#place-header {
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

#place-header h2 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
}

#place-address {
    margin: 0;
    color: #555;
    font-size: 0.9rem;
}

/* Tab Navigation */
.tab-container {
    display: flex;
    border-bottom: 1px solid #ddd;
    background-color: #fff;
}

.tab-button {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background-color: #f1f1f1;
}

.tab-button.active {
    font-weight: bold;
    border-bottom: 3px solid #000000;
}

.tab-button.active:hover {
    background-color: #ffffff;
    cursor: default;
}

/* Content Area */
.content-area {
    padding: 15px;
    line-height: 1.5;
    font-size: 0.95rem;
    color: #333;
}

.disclosure-footer {
    font-size: 0.75rem;
    color: #666;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    font-style: italic;
}

.flag-content-link {
    font-size: 0.75rem;
    color: #666;
    padding: 10px 15px;
}

HTML

<html>
    <head>
        <title>AI Place Summaries</title>
        <link rel="stylesheet" type="text/css" href="./style.css" />
        <script type="module" src="./index.js"></script>
        <!-- prettier-ignore -->
        <script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
        ({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
    </head>
    <body>
        <gmp-map center="37.805, -122.425" zoom="14" map-id="DEMO_MAP_ID">
            <!-- Search Input Card -->
            <div
                class="place-autocomplete-card"
                slot="control-inline-start-block-start">
                <p>Search for a place with AI summaries:</p>
                <gmp-place-autocomplete></gmp-place-autocomplete>
            </div>

            <!-- Summary text panel (initially hidden) -->
            <div
                id="summary-panel"
                class="summary-card hidden"
                slot="control-inline-end-block-start">
                <div id="place-header">
                    <h2 id="place-name"></h2>
                    <p id="place-address"></p>
                </div>

                <!-- Tabs for toggling summary types -->
                <div class="tab-container" id="tab-container"></div>

                <!-- Content display area -->
                <div id="summary-content" class="content-area"></div>

                <!-- Legal/AI Disclosure -->
                <div id="ai-disclosure" class="disclosure-footer"></div>

                <!-- Flag content link -->
                <a id="flag-content-link" class="flag-content-link"></a>
            </div>
        </gmp-map>
    </body>
</html>

Örneği deneyin

Yapay zeka destekli özetler, belirli yerler, bir yerin etrafındaki alan ve bir yerle ilişkili yorumlar hakkında faydalı bilgiler sağlayan yer veya alan özetleridir. Üç farklı yapay zeka destekli özet türü vardır:

  • Yer özeti: Belirli bir yer kimliğine özgü, 100 karakterlik kısa bir genel bakış. Birçok farklı veri türünü bir araya getirerek yerle ilgili üst düzey bir anlık görüntü oluşturur.

  • Yorum özeti: Bir yerin yalnızca kullanıcı yorumlarına dayalı olarak oluşturulan özeti.

  • Alan özeti: Bir yerin çevresindeki alan için oluşturulan özet. Yakındaki ilgi çekici yerler de dahil olmak üzere ek bağlam bilgisi sağlar. Alan özetleri iki türde olabilir:

    • Semt özeti: premise, street_address türündeki yerler ve Konut ile Konaklama kategorilerindeki tüm türler için yakındaki önemli yerlere dair genel bir bakış.

    • Elektrikli araç şarj istasyonu olanaklarının özeti: Türü electric_vehicle_charging_station olan yerlerdeki yakındaki ilgi çekici noktaların genel bir özeti.

Yapay zeka destekli özetleri alma

Yapay zeka destekli özetleri almak ve görüntülemek için aşağıdaki adımları uygulayın:

  1. Places kitaplığını yükleyin.

    const { Place } = await google.maps.importLibrary("places");
  2. Place örneği edinin. Aşağıdaki snippet'te, yer kimliğiyle Place örneği oluşturma işlemi gösterilmektedir:

    const place = new Place("ChIJaYaXFTqq3oARNy537Kb_W_c");
  3. place.fetchFields() çağrınızda, kullanmak istediğiniz özet türlerinin alanlarını belirtin. Aşağıdaki snippet'te tüm özet alanları isteniyor:

    await place.fetchFields({
      fields: [
        'generativeSummary',
        'neighborhoodSummary',
        'reviewSummary',
        'evChargeAmenitySummary'
        // Include other fields as needed.
      ]
    });
              
  4. Özet verileri sırasıyla generativeSummary, neighborhoodSummary, reviewSummary ve evChargeAmenitySummary özelliklerine erişerek alın. Aşağıdaki snippet'te, generativeSummary üzerinden genel bakışın nasıl alındığı gösterilmektedir.

    const summaryText = place.generativeSummary.overview;
            

Tüm yerlerde yapay zeka destekli özetler bulunmadığından, kullanıcılara göstermeden önce gerekli verilerin mevcut olup olmadığını kontrol edin. Aşağıdaki snippet'te generativeSummary olup olmadığı kontrol etmek için bir if ifadesi kullanılır:

if (place.generativeSummary) {
  overviewText = place.generativeSummary.overview;
} else {
  overviewText = 'No summary is available.';
}
    

Alternatif olarak, özetin varlığını kısa ve öz bir şekilde kontrol etmek için nullish operatörünü kullanın:

const overviewText = place.generativeSummary.overview ?? 'No summary is available.';
    

Gerekli ilişkilendirmeleri gösterme

Uygulamanızda gösterilen tüm yapay zeka destekli özetlere, Google'ın politikaları ve standartları uyarınca uygun atıf eklenmelidir. Daha fazla bilgi için Maps JavaScript API ile ilgili politikalar ve ilişkilendirmeler başlıklı makaleyi inceleyin.

Yer özetleri

Yer özetleri, belirli bir yer kimliğine özgü 100 karakterlik kısa özetlerdir. Bu özetler, yerle ilgili üst düzey bir anlık görüntü sağlar. Yer özetlerinde, bir konumda satın alınabilecek popüler yiyecekler, hizmetler veya ürünler vurgulanabilir:

  • "Forum Shops'ta rahat bir ortamda geleneksel İtalyan yemeklerinin büyük porsiyonlarla servis edildiği restoran."

  • "Saç kesimi, boyama ve fön hizmetleri sunan şık bir salon."

  • "Çeşitli vintage dekorasyon ürünleri, mobilyalar ve kıyafetler sunan birçok satıcının bulunduğu büyük mağaza."

Yer özetleri, Desteklenen türler bölümünde gösterilen yer türleri için Kültür, Eğlence ve Rekreasyon, Yeme İçme, Alışveriş, Hizmetler ve Spor kategorilerinde kullanılabilir.

Yer özetleri, aşağıdaki dillerdeki ve bölgelerdeki ilgi çekici yerler için desteklenir:

Dil Bölge
İngilizce

Hindistan

Amerika Birleşik Devletleri

Yer özeti isteme

Üretken yer özeti istemek için fetchFields()'i çağırırken generativeSummary alanını ekleyin:

await place.fetchFields({
    fields: [
        'generativeSummary',
        // Include other fields as needed.
    ],
});
    

Yer özetlerini almak için generativeSummary özelliğini kullanın. Aşağıdaki snippet, generativeSummary öğesinden genel bakış ve açıklama metnini alır:

if (place.generativeSummary) {
    console.log("Place Overview:", place.generativeSummary.overview);
    console.log("Disclosure:", place.generativeSummary.disclosureText);
}
    

Yorum özetleri

Yorum özetleri, yalnızca kullanıcı yorumlarına dayalı olarak oluşturulan özetlerdir. Yorum özetleri, kullanıcı yorumlarının önemli unsurlarını (ör. yer özellikleri ve yorumcu duygusu) sentezleyerek üst düzey analizler sunar ve kullanıcıların bilinçli kararlar vermesine yardımcı olur.

Örneğin, San Francisco'daki Ferry Building'in yorum özetinde yemek ve alışverişten manzaraya ve atmosfere kadar çeşitli bilgiler yer alır:

"Ziyaretçiler, bu tarihi yapının çeşitli mağazalar, restoranlar ve bir üretici pazarı sunduğunu, ayrıca koy ve şehir manzarasıyla övüldüğünü belirtiyor. Ayrıca, canlı atmosferi, diğer yerlere kolayca ulaşılabilen feribot seferleri ve yerel işletmelerden yararlanma fırsatını da vurguluyor."

Yorum özetleri, aşağıdaki dillerde ve bölgelerde ilgi çekici yerler için desteklenir:

Dil Bölge
İngilizce ABD, Arjantin, Bolivya, Brezilya, Dominik Cumhuriyeti, Ekvador, Guatemala, Hindistan, Japonya, Kolombiya, Kosta Rika, Meksika, Paraguay, Peru, Şili, Uruguay, Venezuela, Birleşik Krallık
Japonca Japonya
Portekizce Brezilya
İspanyolca ABD, Arjantin, Bolivya, Dominik Cumhuriyeti, Ekvador, Guatemala, Kolombiya, Kosta Rika, Meksika, Paraguay, Peru, Şili, Uruguay, Venezuela

İnceleme özeti isteğinde bulunma

İnceleme özeti isteğinde bulunmak için fetchFields() işlevini çağırırken reviewSummary alanını ekleyin:

await place.fetchFields({
    fields: [
        'reviewSummary',
        // Include other fields as needed.
    ],
});
  

Yorum özetlerini almak için reviewSummary özelliğini kullanın. Yorum özetlerini almak için reviewSummary.text mülküne erişin. Aşağıdaki snippet, reviewSummary dosyasındaki metni alır.

if (place.reviewSummary) {
    console.log("Place Review Summary:", place.reviewSummary.text);
}
  

Alan özetleri

Bir yerin çevresindeki alan için alan özetleri oluşturulur. Bölge özetleri, yakındaki ilgi çekici yerler de dahil olmak üzere bir konumla ilgili ek bağlam sağlar. Böylece kullanıcılar, nereye gidecekleri ve gittiklerinde ne yapacakları konusunda daha bilinçli kararlar verebilir. Örneğin, yeni bir şehri ziyaret ederken çevredeki alan hakkında daha fazla bilgi edinmek için bir otel için oluşturulan mahalle özetini görüntüleyebilirsiniz:

  • "San Francisco'da North Beach ve Chinatown'ı bir araya getiren bu hareketli bölge, Finans Bölgesi'nin kuzeybatısında yer alır. Burada edebiyatla ilgili önemli yerler, benzersiz kültürel cazibe merkezleri ve çeşitli restoranlar bulunur. Önemli yerler arasında ikonik City Lights Bookstore, büyüleyici Cable Car Museum ve hareketli Chinatown sokakları bulunur."

Elektrikli araç şarj etmeyi düşünüyorsanız çevredeki alan hakkında daha fazla bilgi edinmek için elektrikli araç şarj istasyonuyla ilgili oluşturulan özeti görüntüleyebilirsiniz:

  • "Bu bölgede Starbucks, Sushi Jin ve Safeway gibi 9 dakikalık yürüme mesafesinde çeşitli yemek seçenekleri sunulmaktadır."

Yanıtta, alanın açıklamasının yanı sıra açıklamada referans verilen yerlerle ilgili Place örneklerinin listesi de yer alır. Her yerle ilgili daha fazla bilgi istemek için bu Place örneklerinde fetchFields() işlevini çağırın.

İki tür yapay zeka destekli alan özeti vardır:

  • Mahalle özeti: premise, street_address türündeki yerler ve Konut ile Konaklama kategorilerindeki tüm türler için yakındaki önemli yerlere dair genel bir bakış.

  • Elektrikli araç şarj istasyonu olanaklarının özeti: Türü electric_vehicle_charging_station olan yerler için yakındaki ilgi çekici noktaların genel bir özeti.

Alan özetleri, aşağıdaki dillerde ve bölgelerde önemli yerler için desteklenir:

Dil Bölge
İngilizce Amerika Birleşik Devletleri

Mahalle özeti isteğinde bulunma

premise, street_address türündeki yerler ile Konut ve Konaklama kategorilerindeki tüm türler için mahalle özetleri isteyebilirsiniz. Mahalle özeti istemek için fetchFields() işlevini çağırırken neighborhoodSummary alanını ekleyin:

await place.fetchFields({
    fields: [
        'neighborhoodSummary',
        // Include other fields as needed.
    ],
});
  

Mahalle özetlerini almak için neighborhoodSummary özelliğini kullanın. Mahalle özetlerini almak için metne erişmek üzere neighborhoodSummary.content mülküne erişin.

Aşağıdaki snippet, neighborhoodSummary içeriğini alır:

if (place.neighborhoodSummary) {
    console.log("Place Neighborhood Summary:", place.neighborhoodSummary.overview.content);
}
  

Elektrikli araç şarj istasyonu olanaklarının özetini isteme

electric_vehicle_charging_station türündeki yerler için elektrikli araç şarj istasyonu olanak özetleri isteyebilirsiniz. EVCS hizmet özeti dört tür özet sunar: overview, coffee, restaurant ve store. Bu nedenle veri yapısı, her biri bir özet içeren bir nesne dizisidir. Elektrikli araç şarj istasyonu olanak özeti isteğinde bulunmak için fetchFields() işlevini çağırırken evChargeAmenitySummary alanını ekleyin:

await place.fetchFields({
    fields: [
        'evChargeAmenitySummary',
        // Include other fields as needed.
    ],
});
  

Elektrikli araç şarj istasyonu olanak özetlerini almak için evChargeAmenitySummary özelliğini kullanın. Özetlerden metin almak için evChargeAmenitySummary.overview, evChargeAmenitySummary.coffee, evChargeAmenitySummary.restaurant ve evChargeAmenitySummary.store özelliklerinin content özelliğine erişin.

Aşağıdaki snippet, evChargeAmenitySummary içeriğini alır:

// overview, coffee, restaurant, store.
if (place.evChargeAmenitySummary) {
    console.log("Place EVCS Amenity Summary:", place.evChargeAmenitySummary.overview.content);
    console.log("Coffee:", place.evChargeAmenitySummary.coffee.content);
    console.log("Restaurants:", place.evChargeAmenitySummary.restaurant.content);
    console.log("Stores:", place.evChargeAmenitySummary.store.content);
}