mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Update models.js [ci skip]
This commit is contained in:
parent
93d7ff309f
commit
c7956a4047
|
@ -78,10 +78,15 @@ function isStableVersion(v) {
|
||||||
return !v.includes('a') && !v.includes('b') && !v.includes('dev') && !v.includes('rc')
|
return !v.includes('a') && !v.includes('b') && !v.includes('dev') && !v.includes('rc')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLatestVersion(modelId, compatibility) {
|
function getLatestVersion(modelId, compatibility, prereleases) {
|
||||||
for (let [version, models] of Object.entries(compatibility)) {
|
for (let [version, models] of Object.entries(compatibility)) {
|
||||||
if (isStableVersion(version) && models[modelId]) {
|
if (isStableVersion(version) && models[modelId]) {
|
||||||
return models[modelId][0]
|
const modelVersions = models[modelId]
|
||||||
|
for (let modelVersion of modelVersions) {
|
||||||
|
if (isStableVersion(modelVersion) || prereleases) {
|
||||||
|
return modelVersion
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,12 +152,26 @@ const Help = ({ children }) => (
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
|
|
||||||
const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExamples, licenses }) => {
|
const Model = ({
|
||||||
|
name,
|
||||||
|
langId,
|
||||||
|
langName,
|
||||||
|
baseUrl,
|
||||||
|
repo,
|
||||||
|
compatibility,
|
||||||
|
hasExamples,
|
||||||
|
licenses,
|
||||||
|
prereleases,
|
||||||
|
}) => {
|
||||||
const [initialized, setInitialized] = useState(false)
|
const [initialized, setInitialized] = useState(false)
|
||||||
const [isError, setIsError] = useState(true)
|
const [isError, setIsError] = useState(true)
|
||||||
const [meta, setMeta] = useState({})
|
const [meta, setMeta] = useState({})
|
||||||
const { type, genre, size } = getModelComponents(name)
|
const { type, genre, size } = getModelComponents(name)
|
||||||
const version = useMemo(() => getLatestVersion(name, compatibility), [name, compatibility])
|
const version = useMemo(() => getLatestVersion(name, compatibility, prereleases), [
|
||||||
|
name,
|
||||||
|
compatibility,
|
||||||
|
prereleases,
|
||||||
|
])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.dispatchEvent(new Event('resize')) // scroll position for progress
|
window.dispatchEvent(new Event('resize')) // scroll position for progress
|
||||||
|
@ -332,7 +351,7 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl
|
||||||
const Models = ({ pageContext, repo, children }) => {
|
const Models = ({ pageContext, repo, children }) => {
|
||||||
const [initialized, setInitialized] = useState(false)
|
const [initialized, setInitialized] = useState(false)
|
||||||
const [compatibility, setCompatibility] = useState({})
|
const [compatibility, setCompatibility] = useState({})
|
||||||
const { id, title, meta, hasExamples } = pageContext
|
const { id, title, meta } = pageContext
|
||||||
const { models, isStarters } = meta
|
const { models, isStarters } = meta
|
||||||
const baseUrl = `https://raw.githubusercontent.com/${repo}/master`
|
const baseUrl = `https://raw.githubusercontent.com/${repo}/master`
|
||||||
|
|
||||||
|
@ -381,6 +400,7 @@ const Models = ({ pageContext, repo, children }) => {
|
||||||
repo={repo}
|
repo={repo}
|
||||||
licenses={arrayToObj(site.siteMetadata.licenses, 'id')}
|
licenses={arrayToObj(site.siteMetadata.licenses, 'id')}
|
||||||
hasExamples={meta.hasExamples}
|
hasExamples={meta.hasExamples}
|
||||||
|
prereleases={site.siteMetadata.nightly}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -397,6 +417,7 @@ const query = graphql`
|
||||||
query ModelsQuery {
|
query ModelsQuery {
|
||||||
site {
|
site {
|
||||||
siteMetadata {
|
siteMetadata {
|
||||||
|
nightly
|
||||||
licenses {
|
licenses {
|
||||||
id
|
id
|
||||||
url
|
url
|
||||||
|
|
Loading…
Reference in New Issue
Block a user